Help for dial plan calling from voipzoom

Getting started with the SIP Sorcery
Post Reply
marioliang
Posts: 4
Joined: Thu May 05, 2011 2:46 am

Help for dial plan calling from voipzoom

Post by marioliang » Thu May 05, 2011 3:29 am

Hello,

I want to dial international call using voipzoom, after correctly setup the SIP provider, and named voipzoom, in my dial plan, I am using the following code:

Code: Select all

    when /^(00)(\d{9,})/         # international number
       num = '+011' + $2          # 
       sys.Dial("#{req.Header.From.FromURI.User}@voipzoom")
the response in console is
...
DialPlan 02:57:05:145 sip1(11296): Switching to sip:marioliang@sip*voipzoom*com:5060 via udp:69*59*142*213:5060.
DialPlan 02:57:05:145 sip1(11296): SDP on UAC call had public IP not mangled, RTP socket 68*90*43*21:16478.
DialPlan 02:57:07:676 sip1(11296): Response 400 Bad request for sip:marioliang@sip*voipzoom*com
...
I am not sure how to dial the phone number (num) in the dial plan.

Can anyone give me some clue? Thank you very much.

marioliang

mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

Re: Help for dial plan calling from voipzoom

Post by mnipp » Thu May 05, 2011 4:12 am

Code: Select all

case req.URI.User             # Get dialled number                     eg 00444455555
    when /^(00)(\d{9,})$/      # Test number with international pattern (00)(xxxxxxxxx.)
       num = "011" + $2       # If match replace 00 with 011 on 2nd part of number 011444455555
       sys.Dial("#{num}@voipzoom") # dial corrected number 011444455555@voipzoom

else
    sys.Dial("voipzoom")   # default output provider if no match above
end
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

marioliang
Posts: 4
Joined: Thu May 05, 2011 2:46 am

Re: Help for dial plan calling from voipzoom

Post by marioliang » Fri May 06, 2011 1:46 am

mnipp,

Thank you.

I am using PAP2, how to change the dial plan on the PAP2? Hope you can give me an example.

Sincerely,

marioliang

marioliang
Posts: 4
Joined: Thu May 05, 2011 2:46 am

Re: Help for dial plan calling from voipzoom

Post by marioliang » Fri May 06, 2011 2:36 am

I tried the dial plan but get the response as follow:
DialPlan 02:33:38:199 sip1(16780): Commencing Dial with: +011862084220066@voipzoom
DialPlan 02:33:38:199 sip1(16780): Attempting to locate a provider for call leg: sip:+011862084220066@voipzoom
DialPlan 02:33:38:215 sip1(16780): ForkCall commencing call leg to sip:+011862084220066@sip,voipzoom,com
DialPlan 02:33:38:215 sip1(16780): SIPClientUserAgent Call using alternate outbound proxy of udp:69,59,142,213:5060
DialPlan 02:33:38:215 sip1(16780): Switching to sip:+011862084220066@sip,voipzoom,com:5060 via udp:69,59,142,213:5060
DialPlan 02:33:38:215 sip1(16780): SDP on UAC call had public IP not mangled, RTP socket 68,90,43,21:16466
DialPlan 02:33:40:543 sip1(16780): Response 401 Unauthorized for sip:+011862084220066@sip,voipzoom,com
DialPlan 02:33:41:668 sip1(16780): Information response 100 Trying for sip:+011862084220066@sip,voipzoom,com
DialPlan 02:33:41:668 sip1(16780): Response 404 User not found for sip:+011862084220066@sip,voipzoom,com

mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

Re: Help for dial plan calling from voipzoom

Post by mnipp » Fri May 06, 2011 7:29 am

Looking at the voipzoom website Instructions

http://www.voipzoom.com/en/instructions.html#call

Calling with VoipZoom
Please note that when you call a number (even if it's local) you should always dial 00 + countrycode + areacode + subscribernumber

Looks like dialling (+011 + 86 + 20 + 84220066) is incorrect
(sip:+011862084220066@sip.voipzoom.com) Bad

your dialplan needs to dial (00 + 86 + 20 + 84220066)
(sip:00862084220066@sip.voipzoom.com) Good

Here is a dialpan if your home is Chengdu in China.
This viewtopic.php?f=5&t=1901&start=10 will show UK and Australia versions.
Chengdu in China planplan using voipzoom.com

Code: Select all

def E164num(nume164)    # this section uses (86)China country code (028)Chengdu area and (00)international prefix
                        # you will need to change these rules in the following lines for your country.
   if nume164 =~ /^00/ then 
      nume164 = nume164[2..50]    # remove international prefix (00) 2 digits from front of number 
   else 
      nume164 = "86"  + nume164[1..50] if nume164 =~ /^0/      # national number remove leading 0 add 86 
      nume164 = "8628" + nume164       if nume164.length == 8  # treat local number 8 digits as Chengdu number add 8628 
      nume164 = "86"  + nume164        if !(nume164 =~ /^86/)  # add 86 to remaining China numbers 
   end 
  sys.Log("Number in Enum E164 format +#{nume164}") # check this number in console output
  return nume164
end

   num = req.URI.User.to_s       # get number                       eg. 87654321  A local Chengdu number
   num = num.gsub(/[^0-9*#]/,'') # delete all but digits

   numE164 = E164num(num)  # Expand this number into E164 format    eg. 862887654321
   
  # dialout with voipzoom with its international (00)dialout prefix eg. 00862887654321
   sys.Dial("00#{numE164}@voipzoom")                             # (sip:00862887654321@sip.voipzoom.com)
 
Using this dialplan someone in
Chengdu-China can dial Guangzhou-China with 02084220066 >> sip:00862084220066@sip.voipzoom.com
Chengdu-China to Australia with 0061287654321 >> sip:0061287654321@sip.voipzoom.com
neighbour in Chengdu-China with 87654321 >> sip:00862887654321@sip.voipzoom.com
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

marioliang
Posts: 4
Joined: Thu May 05, 2011 2:46 am

Re: Help for dial plan calling from voipzoom

Post by marioliang » Sat May 07, 2011 2:30 am

Thanks for your help!

Post Reply