Page 5 of 6

Re: Flexible table-controlled dialplan, Version 2

Posted: Fri Sep 03, 2010 5:37 pm
by sint
Yes, that is what I wanted :)
Thank you Mike.


By the way, would you advice on a dialplan for SPA2102 please ?

(xx.S0|*xx.S0|*98S0) is my guess.

( *98 is my code to access mailbox).

Re: Flexible table-controlled dialplan, Version 2

Posted: Fri Sep 03, 2010 6:56 pm
by MikeTelis
I really don't want to pollute this thread with a discussion of SPA configuration. So, let's keep it brief; if you're not satisfied with my response or have additional questions please open a new thread (in Technical Support subforum).

I doubt that a clause like xx.S0 will work properly because S0 should be used with exact number of digits (like 123S0). The dot before S0 should either get device confused or it won't work as expected.

So, unless your numbers are of fixed length (which is not the case, right?) I would suggest something like this:

(*98S0|[*#0-9][*#0-9]x.)

The 2nd pattern allows both * and # symbols in case you need to add them in the future. 2-symbol sequences like **, *# and #* are also supported.

You need to make sure that *98 is not used as one of your "vertical service" codes.

Re: Flexible table-controlled dialplan, Version 2

Posted: Sun Oct 17, 2010 7:02 am
by nlaferle
Hi Mike,

I'm attempting to add your dial plan to my local install of SS. I pasted the contents of the mikesgem.rb linked to your post instead of the 'require' line, and outgoing SIP calls seem to work fine. However, when I attempt to dial out via Google Voice, the plan quits with:

Code: Select all

**Error: Can't convert VSP into Fixnum
The line causing the error seems to be this one:

Code: Select all

      sys.GoogleVoiceCall *vsp.getparams(uri, i + (vsp.rand ? @t.to_i : 0)) 
Did I configure something incorrectly, or is there maybe a different version of mikesgem running on the server? I've include the relevant config lines below.

Would appreciate any help you can offer!

Code: Select all

# Google Voice accounts

Myacnt1  = { :usr => 'user1', :pwd => 'p1' }
Myacnt2  = { :usr => 'user2', :pwd => 'p2' }

ROaccount = [
  Myacnt1 + { :cb => '(747) 111-1111' },
  Myacnt1 + { :cb => '(415) 222-2222' },
]

CHaccount = [
  Myacnt2 + { :cb => '425-22222222' },
]

# SIP accounts

Gizmo      = VSP.new  '#4', '${EXTEN}@Gizmo5',   'Gizmo5'
RoyalOak   = GV.new  '#1', nil, 'GV-248', :account => ROaccount
Chicago    = GV.new  '#2', nil, 'GV-312', :account => CHaccount

# ********************  s e l e c t   V S P  *******************************

def selectVSP    # VoIP provider selection

  case @num
    when /^883/                                      # iNUM
      route_to Gizmo, "iNUM", false                   # disable ENUM

    when /(^1([2-9]\d\d)[2-9]\d{6})/                 # North America
      @num = $1                                      # Truncate to 11 digits
      case $2                                        # check area code
        when "800", "866", "877", "888"              # toll free numbers...
          route_to Gizmo, "USA toll-free", false   # call from GV/San Jose, disable ENUM search
      #  when "415"                                   # San Francisco patch, I have GV number there
      #    route_to Frisco, "San Francisco"
        when "312", "773", "872"                     # Chicago, I have GV number there
          route_to Chicago, "Chicago"
        else
          route_to RoyalOak, "Royal Oak"                         # all other destinations within US & Canada
      end

  

  else
    rejectCall(603,"Number's too short, check & dial again") if @num.length < 9

  end
end

Re: Flexible table-controlled dialplan, Version 2

Posted: Sun Oct 17, 2010 8:24 am
by MikeTelis
Here is the latest version of mikesgem. I didn't find anything wrong in your config.

Re: Flexible table-controlled dialplan, Version 2

Posted: Sun Oct 17, 2010 4:51 pm
by nlaferle
This was weird. Finally figured it out -- for some reason, it was having trouble with the :type of the GV callback number -- it would work fine with my Sipgate number but not with my Gizmo. Something with the logic to pick out area code 747 didn't like my machine. In any event, specifying :type => 7 in the GV Provider hash fixed it.

Thanks!

Re: Flexible table-controlled dialplan, Version 2

Posted: Sun Oct 17, 2010 5:59 pm
by MikeTelis
This is bizarre. I have Gizmo numbers and never had problems with them, the script automatically selects :type => Gizmo (Gizmo is 7, see mikesgem.rb).

I guess you inadvertently tweaked the logic while editing my dialplan. Run diff and try to find what it was.

Re: Flexible table-controlled dialplan, Version 2

Posted: Sat Nov 27, 2010 3:20 am
by siwuxie
Hi, Mike

I added a SIP account as follow.
RK = VSP.new '#5', ' ${EXTEN}@raketu', 'raketu'

I'm using this to make international calls. I call China with prefix 011 plus country code 86. However, everytime when I dial like this pattern #5011868714648283, the call doesn't go through. I also got the following Console message. I think somehow the dial plan just removes prefix 011 automatically Please advise how to modify the plan to make the prefix 011 doesn't get removed. Thanks!

DialPlan 03:11:11:522 sip1(5036): New call from udp:174.95.171.182:5060 successfully authenticated by digest.
DialPlan 03:11:11:553 sip1(5036): Using dialplan default for Out call to sip:#5011868714648283@sipsorcery.com.
NewCall 03:11:11:569 sip1(5036): Executing script dial plan for call to #5011868714648283.
DialPlan 03:11:11:709 sip1(5036): ** Call from "Tao Chen" <sip:siwuxie@sipsorcery.com>;tag=895ad63cd7a8dd15o1 to #5011868714648283 **
DialPlan 03:11:11:725 sip1(5036): Local time: 11/26/2010 22:11
DialPlan 03:11:11:772 sip1(5036): Number in ENUM format: 868714648283
DialPlan 03:11:11:803 sip1(5036): Calling +86 (871) 464-8283 (Forced routing!) with raketu
DialPlan 03:11:11:803 sip1(5036): Commencing Dial with: 868714648283@raketu.
DialPlan 03:11:11:803 sip1(5036): Attempting to locate a provider for call leg: sip:868714648283@raketu.
DialPlan 03:11:11:803 sip1(5036): ForkCall commencing call leg to sip:868714648283@4.78.4.5.
DialPlan 03:11:11:803 sip1(5036): SIPClientUserAgent Call using alternate outbound proxy of udp:69.59.142.213:5060.
DialPlan 03:11:11:803 sip1(5036): Switching to sip:868714648283@4.78.4.5:5060 via udp:69.59.142.213:5060.
DialPlan 03:11:11:803 sip1(5036): SDP on UAC call had RTP socket mangled from 192.168.2.14:16386 to 174.95.171.182:16386.
DialPlan 03:11:12:584 sip1(5036): Response 407 Proxy Authentication Required for sip:868714648283@4.78.4.5.
DialPlan 03:11:12:788 sip1(5036): Information response 100 trying -- your call is important to us for sip:868714648283@4.78.4.5.
DialPlan 03:11:12:788 sip1(5036): Response 404 Not Found for sip:868714648283@4.78.4.5.
DialPlan 03:11:12:788 sip1(5036): Call failed: code 404, Not Found
DialPlan 03:11:12:788 sip1(5036): UAS call failed with a response status of 404 and Not Found.
DialPlan 03:11:12:788 sip1(5036): Dialplan cleanup for siwuxie.
DialPlan 03:11:12:866 sip1(5036): Dial plan execution completed with normal clearing.

Re: Flexible table-controlled dialplan, Version 2

Posted: Sat Nov 27, 2010 4:42 am
by MikeTelis
You need to read the manual (2nd post on the 1st page of this thread) again. The dialplan was designed to remove international prefixes (to_ENUM() method). It's the key point of the dialplan that all dialed numbers are converted into ENUM format (country code + national number) so that it's easy to route the call to appropriate VSP in the selectVSP() method. Besides, ENUM lookup works with the numbers in ENUM format only.

So, you need to rephrase your question. It's not "how to make the prefix 011 doesn't get removed", it's "how do I put the prefix back" :)

If your VSP expects 011 (or any other prefix) before the number, you need to add it in the VSP descriptor:

RK = VSP.new '#5', '011 ${EXTEN}@raketu', 'raketu'

Note (for the future): if you ever need to remove a part of the number, you can also do it in the descriptor using ${EXTEN:n} or ${EXTEN:n:k} format.

Of course, you don't have to dial 011 if you use #5 or any other "forced routing" prefix (it will be removed, anyway), you merely dial #5 followed by the number:

#5868714648283

And finally, forced routing should be regarded as extraordinary measure (for example, your usual VSP for this destination is down at the moment). If you want to terminate your calls to China with Raketu on a regular basis, you should do it in the selectVSP().

Re: Flexible table-controlled dialplan, Version 2

Posted: Thu Jan 06, 2011 3:11 am
by kadalz
Mike:

I have similar problem as siwuxie mentioned. I added SIP account:
Rynga = VSP.new '*3', '00${EXTEN}@Rynga', 'Rynga'

I use it to make international call with prefix 00 plus country code. However, everytime I dial this pattern *362351869352, it is converted into 16235186935. Apparently, it is truncated the last digit and added 1 before 62. What did I do wrong? Thanks for any help.

Here is the console log:
DialPlan 02:52:44:526 sip1(210160): New call from udp:98.249.115.222:5060 successfully authenticated by digest.
DialPlan 02:52:44:557 sip1(210160): Using dialplan default for Out call to sip:*36235xxxx352@sip.sipsorcery.com.
NewCall 02:52:44:588 sip1(210160): Executing script dial plan for call to *36235xxxx352.
DialPlan 02:52:44:729 sip1(210160): ** Call from "Name" <sip:username@sip.sipsorcery.com>;tag=5f19f6ae79e7a10fo0 to *36235xxxx352 **
DialPlan 02:52:44:745 sip1(210160): Local time: 01/05/2011 21:52
DialPlan 02:52:44:760 sip1(210160): Number in ENUM format: 16235xxxx35
DialPlan 02:52:44:791 sip1(210160): Calling +1 (623) 5xx-xx35 (Forced routing!) with Rynga
DialPlan 02:52:44:807 sip1(210160): Commencing Dial with: 0016235xxxx35@Rynga.
DialPlan 02:52:44:807 sip1(210160): Attempting to locate a provider for call leg: sip:0016235xxxx35@Rynga.
DialPlan 02:52:44:807 sip1(210160): ForkCall commencing call leg to sip:0016235xxxx35@sip.rynga.com.

Re: Flexible table-controlled dialplan, Version 2

Posted: Thu Jan 06, 2011 5:35 am
by MikeTelis
The problem is that you omitted international prefix. So, the dialplan is treating your number as US number and therefore the number is prepended with 1 and truncated to 11 digits (1 + 3-digit area code + 7-digit number).

If you want to dial an international number, you need to prepend it with international prefix, like this:

*3 00 62351869352