[Home]

Summary:ASTERISK-08301: [patch] Caller ID not set in CDR
Reporter:phsultan (phsultan)Labels:
Date Opened:2006-12-07 05:16:55.000-0600Date Closed:2007-07-11 19:59:05
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_gtalk
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) branch-1.4-gtalk_cid-1.patch
( 1) branch-1.4-gtalk_cid-2.patch
( 2) trunk-gtalk_cid-1.patch
( 3) trunk-gtalk_cid-2.patch
( 4) trunk-gtalk_cid-3.patch
( 5) trunk-gtalk_cid-4.patch
( 6) trunk-gtalk_cid-5.patch
( 7) trunk-gtalk_cid-6.patch
Description:Call flow is GoogleTalk Client -> Asterisk -> SIP Phone.

Here is the CDR I get when calling from my gmail account, either registered as a user in gtalk.conf or not (eg. calling as a guest) :
       Asterisk-Acc-Code = ""
       Asterisk-Src = ""
       Asterisk-Dst = "s"
       Asterisk-Dst-Ctx = "default"
       Asterisk-Clid = ""
       Asterisk-Chan = "Gtalk/philippe.sultan-ab43"
       Asterisk-Dst-Chan = "SIP/7999-082038e8"
       Asterisk-Last-App = "Dial"
       Asterisk-Last-Data = "SIP/7999"
       Asterisk-Start-Time = "2006-12-07 11:30:12 +0100"
       Asterisk-Answer-Time = "2006-12-07 11:30:17 +0100"
       Asterisk-End-Time = "2006-12-07 11:30:25 +0100"
       Asterisk-Duration = 13
       Asterisk-Bill-Sec = 8
       Asterisk-Disposition = "ANSWERED"
       Asterisk-AMA-Flags = "DOCUMENTATION"
       Asterisk-Unique-ID = "1165487412.0"
       Asterisk-User-Field = ""

Both Asterisk-src and Asterisk-Clid are empty. The attached patch sets cid_name as the full jid, and cid_num as the jid without resource if the calling user is a guest. If the calling user has an matching entry in gtalk.conf, cid_num is set to its username.

CDR becomes :
       Asterisk-Acc-Code = ""
       Asterisk-Src = "philippe.sultan@gmail.com"
       Asterisk-Dst = "s"
       Asterisk-Dst-Ctx = "default"
       Asterisk-Clid = "\"philippe.sultan@gmail.com/Talk.v100FFEA5C14\" <philippe.sultan@gmail.com>"
       Asterisk-Chan = "Gtalk/philippe.sultan-6e67"
       Asterisk-Dst-Chan = "SIP/7999-08208f40"
       Asterisk-Last-App = "Dial"
       Asterisk-Last-Data = "SIP/7999"
       Asterisk-Start-Time = "2006-12-07 11:41:00 +0100"
       Asterisk-Answer-Time = "2006-12-07 11:41:01 +0100"
       Asterisk-End-Time = "2006-12-07 11:41:04 +0100"
       Asterisk-Duration = 4
       Asterisk-Bill-Sec = 3
       Asterisk-Disposition = "ANSWERED"
       Asterisk-AMA-Flags = "DOCUMENTATION"
       Asterisk-Unique-ID = "1165488060.0"
       Asterisk-User-Field = ""



****** ADDITIONAL INFORMATION ******

Caller ID is properly set if call flow is SIP Phone -> Asterisk -> GoogleTalk Client
Comments:By: Anthony LaMantia (alamantia) 2006-12-12 11:03:09.000-0600

i think it may be best to figure out why the callid id code is failing in gtalk_new() and try to fix that,

if we can't and need to place the called-id code in gtalk_alloc() as it is in your patch, we should remove it from gtalk_new().

By: phsultan (phsultan) 2006-12-13 09:17:21.000-0600

True, new patch follows you suggestion and fixes the problem inside gtalk_new().

By: Anthony LaMantia (alamantia) 2006-12-14 17:41:31.000-0600

looks good :), mogorman who would be commiting this to the tree is not around right now, as soon as he gets back i will bring this issue to his attention for commital.

By: Anthony LaMantia (alamantia) 2006-12-14 18:00:06.000-0600

i've noticed a slight problem with this patch, looking at the diff it seems you assigned data like this.

data = ast_strdupa((char *)i->them);

this just allocates information onto the stack, if you try to free it, it will segfault which would be no fun.

you may want to just reaplce this with ast_strdup() .

By: phsultan (phsultan) 2006-12-15 08:19:23.000-0600

Thank you for pointing this. The attached patch will use ast_strdup() instead of ast_strdupa(). Also fixed a similar call to ast_strdupa() in gtalk_alloc().

Serge, tested SVN version is 48471.

Have a nice week end!

By: Anthony LaMantia (alamantia) 2006-12-15 12:47:04.000-0600

ah. nice.
after talking to mog last night, he plans to incorporate into his next chan_gtalk update which he has been working on the over past few days..

he will update this issue when that time arrives. or with any notes he has on the issue.

By: phsultan (phsultan) 2006-12-22 07:53:51.000-0600

Proposed caller id includes domain. This prevents from calling SIP phones, as a wrong Contact header is built, ex. : Contact: sip:user@domain@10.0.0.1 (10.0.0.1 is Asterisk's IP address).

New patch excludes the domain part in cid.cid_num.

--grammatical fix



By: Anthony LaMantia (alamantia) 2006-12-27 11:46:44.000-0600



By: phsultan (phsultan) 2007-01-02 05:27:03.000-0600

Patch also applies to branch 1.4

By: Anthony LaMantia (alamantia) 2007-01-03 19:44:41.000-0600

pokes mog :)

By: phsultan (phsultan) 2007-02-19 13:06:45.000-0600

I detected a problem with the previous patch (trunk-gtalk_cid-4.patch) : as strsep() modifies the memory pointed by data, freeing data may result in a crash. This happens when the guest account is used by a jabber client has a resource value (the string behind '/') not empty in its jid.

New patch adds a auxiliary pointer, so that data can be safely freed in the previous case. A patch for 1.4 is also attached.

By: phsultan (phsultan) 2007-02-21 04:33:43.000-0600

Patch updated to latest revision (conflicts detected).

By: phsultan (phsultan) 2007-03-09 07:24:57.000-0600

Hi Serge, this patch is 'ready for testing' too :D

Any preference for using ast_strdupa() instead of ast_strdup() + free() in the proposed patches?

Have a nice week end,

Philippe

By: Olle Johansson (oej) 2007-05-24 09:53:10

Committed to 1.4 svn rev 65841 and trunk. Thanks!