Hi Mike
Can I ask what the function *args is after the sys.Dial
sys.Dial(@num,*args) # Dial
Flexible table-controlled dialplan
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) )
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
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
At the moment, there is only one additional (optional) parameter: time-out. It is used in the "incoming call processing" portion of the code: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.
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.