My "One for All" Ruby plan ** Updated 08-Oct-08

Catalog of dial plans
jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Sat Oct 04, 2008 7:28 pm

Oke thanks

I am going to change it to background services

My paging file is alrealy 2048 max 4096

Another question :

Do you have an idea why callerid is not always working

When I dial direct to a sip uri it isn't send also when I call with a EnumLookup it isn't send

Myatus
Posts: 30
Joined: Wed Sep 24, 2008 12:49 pm
Location: London, UK

Post by Myatus » Sun Oct 05, 2008 2:14 pm

jvwelzen wrote: Do you have an idea why callerid is not always working

When I dial direct to a sip uri it isn't send also when I call with a EnumLookup it isn't send
I'm using the X-Lite softphone and my caller ID pops up just fine (unless my SIP provider overrides it - for instance, I have a called ID from an Ohio cellphone in the US through Future Nine). So I think it depends on your provider.

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

Post by jvwelzen » Sun Oct 05, 2008 3:37 pm

I use sjphone 1.61

With incoming calls it works fine and with outgoing calls with a provider it also works fine

Only when I call internal or trough a enumlookup it doesn't

Has it to do with the fact that I use numbers as usernames

MikeTelis
Posts: 1582
Joined: Wed Jul 30, 2008 6:48 am

Post by MikeTelis » Sun Oct 05, 2008 6:15 pm

Hi Myatus,

the way you handle URI calls is not completely correct, for two reasons:

1. You can't call a local user (e.g. 'myatus@sip.mysipswitch.com') and
2. Code won't work if domain is specified as 213.200.94.182 instead of sip.mysipswitch.com.

Here is my solution of these issues:

Code: Select all

MyDomain = 'sip.mysipswitch.com'
Domains  = [MyDomain,'213.200.94.182'] # Serviced domains, must be in lowercase!

...

  # check if it's URI or phone number.
  # If destination's host is in our domain, it's a phone call

    num = req.URI.User.to_s; host = req.URI.Host.to_s.downcase

    if host == 'local'          # @local is special, callee is in our domain
      num << '@' << MyDomain
    else
      num << '@' << host    unless Domains.find {|x| x == host}
    end

    callswitch(num)
The code is a bit choppy because "Domains.include?(host)" trigger false alarm ("include statement in dialplan") but I hope this will be fixed in the future release of MSS. In the meantime I used 'find" as a workaround.

It's possible to call local users (use sip:myatus@local instead of sip:myatus@sip.mysipswitch.com) and the code is able to service several domains. Of course, it takes a bit more of editing during dialplan configuration, but every coin has two sides (that's what a man said when his mother-in-law died and he had to pay for the funeral) :D

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Post by Aaron » Sun Oct 05, 2008 10:13 pm

MikeTelis wrote:2. Code won't work if domain is specified as 213.200.94.182 instead of sip.mysipswitch.com.
Hi Mike,

As far as the mss server is concerned all the Dial strings below are equivalent and will result in the call being forwarded to a lcoal user with no additional dialplan processing required.

sys.Dial("user@local")
sys.Dial("user@sip.mysipswitch.com")
sys.Dial("user@213.200.94.182")
sys.Dial("user@213.200.94.182:5060")
sys.Dial("user@213.200.94.182:xxxx") where xxxx are the other ports that mss operates on and that I can't recall off the top of my head.

Regards,

Aaron

MikeTelis
Posts: 1582
Joined: Wed Jul 30, 2008 6:48 am

Post by MikeTelis » Mon Oct 06, 2008 4:35 am

Hi Aaron,

probably we're talking about different things. Yes, incoming calls are processed as you described and invoke user's dialplan with sys.In == true.

I was talking about outbound calls. My softphone, Bria, would dial:

'number@sip.mysipswitch.com' or 'number@213.200.94.182 when I ask it to dial a phone number

URI, such as 'xxxxxx@us.voxalot.com', when I call a softphone

URI also maybe in form 'user@local'.

Within the dialplan, we need to distinguish between outbound phone call, call to URI and call to local user (user@sip.mysipswitch.com). We do it by checking the "host" portion of URI passed to dialplan.

Mike

Myatus
Posts: 30
Joined: Wed Sep 24, 2008 12:49 pm
Location: London, UK

Post by Myatus » Mon Oct 06, 2008 7:00 pm

Hi Mike

Yeah, I only check what the authorized user's hostname is and base on that I figure out if it's a regular phone call or URI call. But as you mentioned, it doesn't check against the IP or if it was really an MSS-to-MSS call.

At first I thought I'd simply dial the full "user@sip.mysipswitch.com", and let MSS figure out if its a local user or (if that user doesn't exist on MSS) a phone number.

But if someone at MSS uses all digits for the username (like me), then this user might be called by mistake if it happens to correspond with an actual phone number... What if I'd dial 5551212 and there's a user 5551212@sip.mysipswitch.com?

So yes, I think that your @local solution would be the best option :)
The code is a bit choppy because "Domains.include?(host)" trigger false alarm ("include statement in dialplan") but I hope this will be fixed in the future release of MSS. In the meantime I used 'find" as a workaround.
Yeah, that's why I'm using the find as well. It wouldn't let me do it otherwise. A bit slower, but it works...
but every coin has two sides (that's what a man said when his mother-in-law died and he had to pay for the funeral) :D
LOL! That's a new one to me.

Thanks for the heads up and the code snippet!

MikeTelis
Posts: 1582
Joined: Wed Jul 30, 2008 6:48 am

Post by MikeTelis » Mon Oct 06, 2008 7:22 pm

Mike,

the probability of running into "all digits" user name @MSS is very high. I guess many people are using MSS provisioning and extension numbers are all digit. I'm not following that thread (waiting until it's finalized) but it seems that now extension numbers are 10-digit, not 8-digit and it corresponds to 10-digit US numbers.

So, '@local' was the only feasible option.

Checking on IP address is also mandatory. For example, PocketPC version of SJPhone doesn't work unless I put real IP address (not sip.mysipswitch.com) in its proxy profile.

Mike

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Post by Aaron » Mon Oct 06, 2008 10:07 pm

MikeTelis wrote:Mike,

the probability of running into "all digits" user name @MSS is very high. I guess many people are using MSS provisioning and extension numbers are all digit. I'm not following that thread (waiting until it's finalized) but it seems that now extension numbers are 10-digit, not 8-digit and it corresponds to 10-digit US numbers.
When an extension/SIP accoun is provisioned there is a check done to make sure there is no extension/SIP account with the same name. Both extensions and SIP usernames will be unique for each mss domain. The same username or extension could be used in different domains though.

Regards,

Aaron

MikeTelis
Posts: 1582
Joined: Wed Jul 30, 2008 6:48 am

Post by MikeTelis » Tue Oct 07, 2008 5:52 am

Hi Aaron,

it seems that all these complicated issues with ACK, doubled "outgoing call", Ruby's pop-up windows and betamax refund had a negative impact on your ability to understand simple things we're talking about here :)

Let me try to translate. We want to place both regular phone calls and URI calls. What happens if someone dials

1 212 555 1212

on a SIP telephone connected to MSS? Ruby dialplan is called with URI

12125551212@sip.mysipswitch.com

Now, what if I want to call a MSS user who has MSS username '12125551212' ? The dialplan will be called with exactly the same URI.

Now, we need to distinguish between calls to a telephone and to a local user. I suggested that we do it by using URIs in form:

12125551212@local

The dialplan will check on the "host" portion of URI and, if it's "local", place URI call to local domain.

Hope that everything's clear now.

Sincerely,

Mike

Post Reply