Add country code

Catalog of dial plans
Post Reply
Salah
Posts: 4
Joined: Thu Nov 19, 2009 10:33 am

Add country code

Post by Salah » Thu Nov 19, 2009 11:11 am

Hi

I'm new using SipSorcery, and I'm trying to change the prefix in my diall plans.

For now I have something like that :

Code: Select all

when /^01/ then sys.Dial("sip1")
Instead of calling my number that starts with "01" with sip1, I'd like the dial plans to add the french country code.

Instead of dialing 01XXXXXXXX, that will dial 00331XXXXXXXX.

Do you have any idea ?

Thanks for helping

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

Post by mnipp » Thu Nov 19, 2009 11:22 am

This is what you want

Code: Select all

when /^01/ then sys.Dial("0033${dst:1}@sip1")

${dst}         = '01XXXXXXXX' 
${dst:1}      = '1XXXXXXXX' 
0033${dst:1}= '00331XXXXXXXX'
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Thu Nov 19, 2009 11:26 am

You can do it like this

Code: Select all

when /^01/ then sys.Dial("0033${dst:1}@sip1")

Salah
Posts: 4
Joined: Thu Nov 19, 2009 10:33 am

Post by Salah » Thu Nov 19, 2009 12:23 pm

Thank you.
That's what I tried but it doesnt works, I see the dialing in my SIP client then it ends.
In the "Calls" console, I got a "Server internal failure" status 500.

Am I doing something wrong ?

Code: Select all

#Ruby
# Dial Plan Generated by Rubyzard v0.1 
# If you need help, please post in our forum
# http://www.mysipswitch.com 

# SIP tracing : true or false 
sys.Trace = false 

sys.Log("call from #{req.Header.From.FromURI.ToString()} to #{req.URI.User}.")

if sys.In then
 # Do your INCOMING call processing customisations here.
 
else
  # Do your OUTGOING call processing customisations here.
	 case req.URI.User
		 when /^01/ then sys.Dial("0033${dst:1}@sip1")
		 else sys.Dial("sip2")
	 end
 
end

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

Post by mnipp » Thu Nov 19, 2009 12:35 pm

looks ok, so lets keep it simple. since you have no incoming rules and can start an inplan for that.

outplan

Code: Select all

# Do your OUTGOING call processing customisations here. 
sys.Log("call from #{req.Header.From.FromURI.ToString()} to #{req.URI.User}.") 

case req.URI.User 
  when /^01/ then sys.Dial("0033${dst:1}@sip1")
else 
  sys.Dial("sip2") 
end
and check your SIP provider names are sip1 and sip2 in your SIP provider settings
Last edited by mnipp on Thu Nov 19, 2009 12:38 pm, edited 1 time in total.
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

Salah
Posts: 4
Joined: Thu Nov 19, 2009 10:33 am

Post by Salah » Thu Nov 19, 2009 12:36 pm

I think my SIP provider has some problems for now, I'll try later.

Salah
Posts: 4
Joined: Thu Nov 19, 2009 10:33 am

Post by Salah » Fri Nov 20, 2009 10:49 am

Ok it works now, thanks ;)

Post Reply