Flexible table-controlled dialplan

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

Post by jvwelzen » Sat Jan 16, 2010 8:17 pm

Hi Mike

Can I ask what the function *args is after the sys.Dial

sys.Dial(@num,*args) # Dial

rod178
Posts: 104
Joined: Sun Apr 12, 2009 12:41 pm
Location: Australia

Post by rod178 » Mon Jan 18, 2010 6:18 am

*args facilitates passing a variable number of arguments to the method, although I slso have never been able to determine the reason that it has been included.

rod178
Posts: 104
Joined: Sun Apr 12, 2009 12:41 pm
Location: Australia

Post by rod178 » Mon Jan 18, 2010 6:25 am

Mike

A question below regared your dial plan, which I have modified for my own use. Details as follows:

Code for outbound dial plan (modified from Mike Telis dial plan(s) )

Code: Select all

else                    # Outbound call ... 
     sys.Log("ReqURI: '#{req.URI.ToString}'") 
     sys.Log("ReqHost: '#{req.URI.Host}'") 
     sys.Log("ReqUser: '#{req.URI.User}'") 
    # 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; reqHost = req.URI.Host.to_s  # Get User and Host 
    host = reqHost.downcase.slice(/[^:]+/) #Convert to lowercase & delete optional ":port" 
    num << '@' << reqHost unless Domains.find {|x| x == host} #URI dialling unless host in domain list 
    callswitch(num)


Dial
6**555


Output
DialPlan=> Dialplan trace commenced at 17 Jan 2010 21:41:28:364.
DialPlan=> ** Call from "61812345678" <sip:61812345678@sipsorcery.com>;tag=ed70bf6d9c93b25co0 to 6**5 **
DialPlan=> START ======= Local time ======= : 01/18/2010 04:41
DialPlan=> ReqURI: 'sip:6**5@sipsorcery.com'
DialPlan=> ReqHost: 'sipsorcery.com'
DialPlan=> ReqUser: '6**5'



Notes on Output
It seems that all except the last char after * is truncated.
Result should be -
ReqURI: 'sip:6**555@sipsorcery.com'
ReqUser: '6**555'



Questions
Why/how is the dialling string truncated?
How to prevent truncation

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

Post by MikeTelis » Tue Jan 26, 2010 5:49 pm

I'm almost sure the problem is in your ATA or softphone's dialplan. That is, truncation occurs before the dialstring is sent to Sipsorcery.

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

Post by MikeTelis » Tue Jan 26, 2010 9:55 pm

rod178 wrote:*args facilitates passing a variable number of arguments to the method, although I slso have never been able to determine the reason that it has been included.
At the moment, there is only one additional (optional) parameter: time-out. It is used in the "incoming call processing" portion of the code:

callswitch("123-4567",35)

Time-out is "tunneled" through callswitch to dial method and from there passed to sys.Dial.

I preferred to use this "variable number of parameters" syntax to minimize changes to the code should Aaron decide to add more optional parameters to sys.Dial.

Post Reply