My "One for All" Ruby plan ** Updated 08-Oct-08
I did some testing between xlite 3.0 and Sjphone
If I call from Sjphone to Sjphone trough a Enumlookup then Sjphone is trying to send the name and not the number and I get Unknown in the screen and I was not able to call back because I was running the sipswitch on port 5061 now I am running the sipswitch on port 5060 and now I am able to call back but it still shows the name as Unknown but I can callback because it's running on port 5060
When I call from sjphone to Xlite it also shows unknown but I can callback
When I call from xlite to Sjphone It shows the username or number in my case because I use numbers as usernames and I also can callback
Is it possible that I can send the number also as username
Thanks in advance...
If I call from Sjphone to Sjphone trough a Enumlookup then Sjphone is trying to send the name and not the number and I get Unknown in the screen and I was not able to call back because I was running the sipswitch on port 5061 now I am running the sipswitch on port 5060 and now I am able to call back but it still shows the name as Unknown but I can callback because it's running on port 5060
When I call from sjphone to Xlite it also shows unknown but I can callback
When I call from xlite to Sjphone It shows the username or number in my case because I use numbers as usernames and I also can callback
Is it possible that I can send the number also as username
Thanks in advance...
It seems that this is not working when calling trough a EnumLookup
"6:00-17:30" => "officephone@asip.com!10#homephone@asip.com!5",
the homephone is not working
"6:00-17:30" => "officephone@asip.com!10#homephone@asip.com!5",
the homephone is not working
Updated Dial Plan (08 October 2008)
I have updated the dialplan according to the suggestions and requests. Simply cut & paste the new code shown on the first page.
I've also added the details on how to configure the dialplan, as it now includes a few more options.
First thing that's been changed is the ability to make MSS to MSS calls. As Mike (MikeTelis) pointed out, the original dialplan couldn't do this.
The "problem" lies in the fact that a call to a PSTN is received as "1234@sip.mysipswitch.com" whilst a call to another MSS user is "a_user@sip.mysipswitch.com". A MMS user with the User ID "1234" would receive the call destined for PSTN 1234...
This has been solved threefold. First, you can specify a full URI in the form of "sip:(mss_user)@local" where mss_user is obviously the intended party.
Secondly, the dialplan has the ability to define a local area code that will get routed "interally" - to other MSS users. This local area code can be dialed along with a country code, if the dialplan is setup as such. For example, local area code 099 can be called as 099(user_id) or 4499(user_id) if your country code was set to 44. For more details, see the LocalAreaCode option.
Lastly, some users are more used to the "dial 9 first" to make an external call. You can use this option instead of the LocalAreaCode option. So all calls are routed internally (to another MSS user) by default, unless you dial "9" first.
The last two options were added to avoid having to specify a full URI. Ie., just dial the numbers and that's it. However, it goes by the assumption that the other user ID is a number. For instance, you cannot "dial" the user ID "johndoe". For local installations, you could therefore "force" the use of a numer user ID for full compatibility.
Furthermore, as per request, I've added the ability to force your User ID as the "Caller ID" with the UserIDAsOutgoingCallerID option. This takes your MSS user ID (let's say, "5551212" out of "5551212@sip.mysipswitch.com") and inserts this in the field commonly used to identify the caller. Do keep in mind that some providers will override this field.
I've also added the details on how to configure the dialplan, as it now includes a few more options.
First thing that's been changed is the ability to make MSS to MSS calls. As Mike (MikeTelis) pointed out, the original dialplan couldn't do this.
The "problem" lies in the fact that a call to a PSTN is received as "1234@sip.mysipswitch.com" whilst a call to another MSS user is "a_user@sip.mysipswitch.com". A MMS user with the User ID "1234" would receive the call destined for PSTN 1234...
This has been solved threefold. First, you can specify a full URI in the form of "sip:(mss_user)@local" where mss_user is obviously the intended party.
Secondly, the dialplan has the ability to define a local area code that will get routed "interally" - to other MSS users. This local area code can be dialed along with a country code, if the dialplan is setup as such. For example, local area code 099 can be called as 099(user_id) or 4499(user_id) if your country code was set to 44. For more details, see the LocalAreaCode option.
Lastly, some users are more used to the "dial 9 first" to make an external call. You can use this option instead of the LocalAreaCode option. So all calls are routed internally (to another MSS user) by default, unless you dial "9" first.
The last two options were added to avoid having to specify a full URI. Ie., just dial the numbers and that's it. However, it goes by the assumption that the other user ID is a number. For instance, you cannot "dial" the user ID "johndoe". For local installations, you could therefore "force" the use of a numer user ID for full compatibility.
Furthermore, as per request, I've added the ability to force your User ID as the "Caller ID" with the UserIDAsOutgoingCallerID option. This takes your MSS user ID (let's say, "5551212" out of "5551212@sip.mysipswitch.com") and inserts this in the field commonly used to identify the caller. Do keep in mind that some providers will override this field.
Last edited by Myatus on Wed Oct 08, 2008 6:46 am, edited 1 time in total.
Dag Jeroen,
Mike
I've fixed this in today's update. I broke this when I started to use the TNumber class for answer rules.jvwelzen wrote:It seems that this is not working when calling trough a EnumLookup
"6:00-17:30" => "officephone@asip.com!10#homephone@asip.com!5",
the homephone is not working
Mike
Hi Mike(s),
First thanks for all the effort put into the dial plan!
I decided to give it a bit of a spin today and after a few little hiccups was able to get it doing what I wanted.
A few little gotchas.
1. My phone and a lot of others will send URIs with parameters on the end, for example:
sip:300@sip.mysipswitch.com:5060;user=phone
In its current form that will break the dial plan (see the next point),
2. The regular expression in fixupnumber can be modified to simplify and also fix up the above issue:
3. If I dial 300@sip.mysipswitch.com:5060 I was ending up with a destination of 300:5060 I had to comment out the line below to get aorund this which is not going to be ideal.
number << ":" << port unless port.empty?
Regards,
Aaron
First thanks for all the effort put into the dial plan!
I decided to give it a bit of a spin today and after a few little hiccups was able to get it doing what I wanted.
A few little gotchas.
1. My phone and a lot of others will send URIs with parameters on the end, for example:
sip:300@sip.mysipswitch.com:5060;user=phone
In its current form that will break the dial plan (see the next point),
2. The regular expression in fixupnumber can be modified to simplify and also fix up the above issue:
Code: Select all
number = String.new(aNumber =~ /^(.+)@(.+?):(\d*)/ ? $1.to_s : aNumber)
host = $2.to_s.downcase
port = $3
number << ":" << port unless port.empty?
Regards,
Aaron
Hi Mike,
There is no Port property on a URI. If present the port will always be part of the Host property.
It's probably not worth separating the port from the host anyway as the port will never be of any use by itself. To detect local domains it would be better to check for both sip.mysipswitch.com and sip.mysipswitch.com:5060 etc.
Regards,
Aaron
There is no Port property on a URI. If present the port will always be part of the Host property.
It's probably not worth separating the port from the host anyway as the port will never be of any use by itself. To detect local domains it would be better to check for both sip.mysipswitch.com and sip.mysipswitch.com:5060 etc.
Regards,
Aaron
Hi Aaron,
finally, your words sunken in and I decided to get rid of replacing "@local" with "@sip.mysipswitch.com" and it seems like I found a couple of bugs in the process:
1. It seems like "in-house" calls are taking a shortcut! For example, I call a local user ("User@sip.mysipswitch.com", where user is my girlfriend's account name @MSS). If her ATA is online, everything works fine. However, if she's not online, I get an error response, you don't even try to execute her Ruby dialplan (where we have forwarding)!
2. sys.Dial("User@local") works fine but sys.Dial("User@local:5060") fails!
sys.Dial("User@sip.mysipswitch.com:5060") works, though.
Could you please comment?
Mike
P.S. Just in case, here is a snippet of my code:
finally, your words sunken in and I decided to get rid of replacing "@local" with "@sip.mysipswitch.com" and it seems like I found a couple of bugs in the process:
1. It seems like "in-house" calls are taking a shortcut! For example, I call a local user ("User@sip.mysipswitch.com", where user is my girlfriend's account name @MSS). If her ATA is online, everything works fine. However, if she's not online, I get an error response, you don't even try to execute her Ruby dialplan (where we have forwarding)!
2. sys.Dial("User@local") works fine but sys.Dial("User@local:5060") fails!
sys.Dial("User@sip.mysipswitch.com:5060") works, though.
Could you please comment?
Mike
P.S. Just in case, here is a snippet of my code:
Code: Select all
num = req.URI.User.to_s; reqHost = req.URI.Host.to_s # Get User and Host
host = reqHost.downcase.slice(/[^:]+/) # Convert to lowercase and delete optional ":port"
# URI dialing if host is not in our domain list or 'local'
num << '@' << reqHost if host == 'local' or !Domains.find {|x| x == host}
Hi Mike,
"local" is obviously not a valid hostname instead it's a shortcut to allow users to easily designate a call for the local server. I could add another alias "local:5060" but I don't really see the point, the port on the end would have no meaning and the whole string would just be another shortcut.
If a SIP account is using a Ruby dialplan incoming calls will always be processed in the dialplan. If an Asterisk dialplan is being used and there is no matching extension in the dialplan then an incoming call will go straight to the SIP account. There is no situation where a dialplan is not used because of an account being offline. Perhaps the call is just not getting to where you expected to in the dialplan.
Regards,
Aaron
"local" is obviously not a valid hostname instead it's a shortcut to allow users to easily designate a call for the local server. I could add another alias "local:5060" but I don't really see the point, the port on the end would have no meaning and the whole string would just be another shortcut.
If a SIP account is using a Ruby dialplan incoming calls will always be processed in the dialplan. If an Asterisk dialplan is being used and there is no matching extension in the dialplan then an incoming call will go straight to the SIP account. There is no situation where a dialplan is not used because of an account being offline. Perhaps the call is just not getting to where you expected to in the dialplan.
Regards,
Aaron