[asterisk-dev] [Code Review] Asterisk Unique ID for call logging - Phase III part 1 - Binding Call IDs before entering PBX in the SIP channel driver

jrose reviewboard at asterisk.org
Mon Apr 23 14:18:54 CDT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1868/
-----------------------------------------------------------

(Updated April 23, 2012, 2:18 p.m.)


Review request for Asterisk Developers, Mark Michelson, rmudgett, and Matt Jordan.


Changes
-------

This patch adds IAX2 specific thread association and channel binding and also addresses a few minor changes in SIP.  Also, some pbx changes are made to ensure callids get created with calls made via originate and possibly a few other avenues.

SIP and IAX also received more testing with SIP in particular. Transfers generally result in a new callid being created and then used regardless of whether they are blind transfers or attended transfers. This is because the requestor and the requestee are always going to be new channels. An exception to this rule however occurs when an endpoint transfers a call that stays within the PBX.  In this case, whatever callid the PBX was running with first is used as the callid for the call once everything is bridged. This probably isn't a big deal since calls that stay within the PBX probably shouldn't be transferred in the first place, but even then it isn't necessarily wrong to keep the same callid. If that is something that needs to be changed though for the sake of consistency, that might be tricky since there isn't really an associated channel with what is being transferred.  Instead, the new channel gets its callid from the thread running the pbx.

Some sig_analog changes have been made as well, but aren't included with this patch since they are completely untested with many of the new changes to core components (channel.c, pbx.c, etc.)


Summary
-------

This patch adds a number of new functions involving channels and call identifiers to allow the creation of callids within specific channel drivers so that log messages can be bound to a call ID before going into the PBX.  The SIP channel driver is used to demonstrate the methodology involved. Also adds display of callid involved with a channel in core show channel if it is a channel that has been deliberately bound to call id.


Diffs (updated)
-----

  /team/jrose/call_identifiers/channels/chan_iax2.c 363206 
  /team/jrose/call_identifiers/channels/chan_sip.c 363206 
  /team/jrose/call_identifiers/channels/sip/include/dialog.h 363206 
  /team/jrose/call_identifiers/channels/sip/include/sip.h 363206 
  /team/jrose/call_identifiers/include/asterisk/channel.h 363206 
  /team/jrose/call_identifiers/include/asterisk/logger.h 363206 
  /team/jrose/call_identifiers/main/channel.c 363206 
  /team/jrose/call_identifiers/main/channel_internal_api.c 363206 
  /team/jrose/call_identifiers/main/cli.c 363206 
  /team/jrose/call_identifiers/main/logger.c 363206 
  /team/jrose/call_identifiers/main/pbx.c 363206 

Diff: https://reviewboard.asterisk.org/r/1868/diff


Testing
-------

Normal calls, calls being transfered, calls being rejected from Chan SIP.

EDIT:
I have a few scenarios to detail, and the behavior of one of them might be less than awesome.

1 - peer A calls extension to dial peer B (single invite, no reauthorization takes place)
A call ID is generated and bound to the channel for peer A making the call. The PBX thread is started and also takes a reference to the Call ID copied from the channel. Peer is dialed and when that channel is created, it gets a reference to the call ID as well.  This is pretty ideal.

2 - peer C calls extension to dial peer B (reauthorization takes place, so a second invite happens before C connects)
In this case, the first invite gets a call ID which is bound to the SIP thread momentarily before the call is confirmed as being unable to complete.  Peer C sends a second invite with authorization, which causes a second call ID to be created which gets bound to the call.  This is a bit of a problem since the call ID should ideally be the same for both the preauthorized and post authorized portions of the call, so it needs some work.

As for transfer scenarios, it was tested with both blind and attended transfers.  In the case of a blind transfer, the call ID remains the same throughout the whole process.  For attended transfers however, a new call ID is created which covers the transferring channel as well as the channel receiving the transfer.  Once the transfer is completed, the transferred channel is also on the new call ID.  This behavior might not be a problem, though it is perhaps a little inconsistent.


Thanks,

jrose

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120423/3a890e49/attachment.htm>


More information about the asterisk-dev mailing list