260 likes | 344 Views
Learn how to utilize Connected Party Information in Asterisk using ISDN and SIP, with practical examples and configuration settings. Enhance call management and understand technical details for effective communication.
E N D
Making the most of Connected Party Information in Asterisk Mark Michelson Software Developer, Digium, Inc.
What is Connected Party Information? • ISDN: COLP and CONP • SIP: P-Asserted-Identity and Remote-Party-Id • "The reverse of Caller*ID" • Can be updated throughout the course of a call
Contributors • Gareth Palmer • Community member from New Zealand • Initial implementation (issue 8824) for chan_sip and chan_skinny, func_connectedline • Richard Mudgett • Digium Software Developer • Core API, chan_misdn, chan_dahdi, libpri • Mark Michelson • Digium Software Developer • chan_sip, app_dial, app_queue, features (transfers, pickup, etc.), interception macros
[Alice]callerid = Alice <11111> [Bob]callerid = Bob <22222> [Carol]callerid = Carol <33333> Configuration example
Alice dials Bob...Alice's Display Bob's Display Bob's phone rings...Alice's Display Bob's Display Alice Calls Bob Prior to 1.6.3 Alice <11111>
Bob preses transfer and calls Carol Bob's Display Carol's Display Alice and Carol are connected. Alice's Display Carol's Display Bob Transfers Alice to Carol prior to 1.6.3 Alice <11111> Bob <22222> Bob <22222>
Alice dials Bob...Alice's Display Bob's Display Bob's phone rings...Alice's Display Bob's Display Alice Calls Bob in 1.6.3+ Bob <22222> Alice <11111>
Bob preses transfer and calls Carol Bob's Display Carol's Display Alice and Carol are connected. Alice's Display Carol's Display Bob Transfers Alice to Carol prior to 1.6.3 Carol <33333> Bob <22222> Carol <33333> Alice <11111>
SIP Technical Details • Read P-Asserted-Identity and Remote-Party-ID headers on incoming messages. • Transmit either P-Asserted-Identity or Remote-Party-ID headers on • Provisional responses to INVITEs • 200 OK responses to INVITEs • Outbound INVITEs • Outbound UPDATEs
SIP configuration settings • sendrpid – Four possible values: • rpid: Use Remote-Party-ID header • pai: Use P-Asserted-Identity header • yes: Same as “rpid” (old old old option) • no: Do not send connected party information • trustrpid – Yes or no option. Tells whether to accept connected party information.
SIP configuration settings, contd. • rpid_immediate – Yes or no setting. Should we generate a provisional response just for communicating updated connected party information? • rpid_update: Yes or no setting. Controls whether connected line updates can be sent in UPDATE requests.
ISDN technical details • Both mISDN and libpri use new IEs • connected-number-ie in CONNECT • Connected name facility (Q.SIG only) • FACILITY and NOTIFY messages used more frequently
ISDN configuration settings • misdn.conf • More type-of-number prefix strings • outgoing_colp: Controls whether to send COLP • 0: Send out COLP unaltered • 1: Force COLP to restricted • 2: Do not send COLP • display_connected: Affects display IE in CONNECT • 0: No COLP/CONP in display IE • 1: CONP in display IE • 2: COLP in display IE • 3: COLP and CONP in display IE
ISDN configuration settings, contd. • misdn.conf, continued • display_setup: Affects display IE in SETUP • 0: No caller information in display IE • 1: Caller name in display IE • 2: Caller number in display IE • 3: Caller name and number in display IE • chan_dahdi.conf: COLP/CONP supported with no new configuration options.
"Just Works" vs. Meticulous Control • "Just works" • callerid setting • Automatically updated on transfer • Meticulous control • new configuration settings • func_connectedline • 'I' option to Dial • Interception macros
func_connectedline • CONNECTEDLINE(parameter[,i]) • Valid Parameters: • name: called name • number: called number • all: called name and number • ton: type of number • pres: called number presentation • The 'i' option: • If present, do not send a message out, only make the change internally.
[default]exten => 4000,1,Set(CONNECTEDLINE(name)=John Smith)exten => 4000,n,Set(CONNECTEDLINE(number)=4000)exten => 4000,n,Set(CONNECTEDLINE(ton)=0)exten => 4000,n,Set(CONNECTEDLINE(pres)=allowed) There are four messages sent to the caller's channel as a result of this! What's wrong with the following dialplan?
[default]; Notice the i in the first three statementsexten => 4000,1,Set(CONNECTEDLINE(name,i)=John Smith)exten => 4000,n,Set(CONNECTEDLINE(number,i)=4000)exten => 4000,n,Set(CONNECTEDLINE(ton,i)=0)exten => 4000,n,Set(CONNECTEDLINE(pres)=allowed) Now only a single message is sent after all parameters are set. Corrected Dialplan example
New option for Dial and Queue • I – Do not overwrite connected party information already set on inbound channel. • Slightly different semantics from not trusting received information • Common dialplan idiom: [default]exten => 4000,1,Set(CONNECTEDLINE(name,i)=John Smith)exten => 4000,n,Set(CONNECTEDLINE(number,i)=4000)exten => 4000,n,Set(CONNECTEDLINE(ton,i)=0)exten => 4000,n,Set(CONNECTEDLINE(pres)=allowed)exten => 4000,n,Dial(SIP/4000,20,I)exten => 4000,n,Hangup
Interception macros • Set through channel variables • CONNECTED_LINE_CALLER_SEND_MACRO • CONNECTED_LINE_CALLER_SEND_MACRO_ARGS • CONNECTED_LINE_CALLEE_SEND_MACRO • CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS • CALLER_SEND macro runs on caller's channel if connected party update is received on callee's channel, for example • Update is automatically sent (so 'i' usage is recommended) • Recommend to prefix channel variables with __
[default]exten => 3000,1,Set(__CONNECTED_LINE_CALLER_SEND_MACRO=add_pfx)exten => 3000,n,Set(__CONNECTED_LINE_CALLER_SEND_MACRO_ARGS=45,4)exten => 3000,n,Dial(SIP/3000,30)exten => 3000,n,Hangup [macro-add_pfx];ARG1 is prefix to add;ARG2 is number of digits at end to add prefix toexten => s,1,Set(NOPREFIX=${CONNECTEDLINE(number):-${ARG2}})exten => s,n,Set(CONNECTEDLINE(number,i)=${ARG1}${NOPREFIX})exten => s,n,MacroExit Interception Macro Example
Ideas for Usage • IVR that updates connected name on each selection made • Disguise the true number of an individual with a generic "company number" • Use interception macros to make outbound connected number E.164 formatted • You can do a lot more in an interception macro than just update connected party info...
Troubleshooting Tips • For CONNECTEDLINE, check for rampant 'i's. • Check channel configuration settings. The default settings may not be what you want or expect. • Check packet captures. Your equipment may not support what Asterisk sends. • As always, bugs should be reported to https://issues.asterisk.org
Addendum: Redirecting • Similar to connected party info, but for forwarded/deflected calls • REDIRECTING dialplan function similar to CONNECTEDLINE • Be certain to read CHANGES file for some gotchas with ISDN
Future Development Ideas • Manager Events • RECV variants of interception macros • Update other channel drivers • Interception macro makeover