<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Cambria;
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Cambria","serif";
        color:#000066;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Cambria","serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>IMO you are trying to circumvent basic Asterisk functionality.&nbsp; It&#8217;s your CDR so you can do what you want with it &#8211; I think the answer to this is to populate another DB with the live call data, then update the CDR from that after the call has ended (perhaps a daemon).<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Harel Cohen<br><b>Sent:</b> Tuesday, December 06, 2011 3:16 AM<br><b>To:</b> asterisk-users@lists.digium.com<br><b>Subject:</b> [asterisk-users] Populate CDR issues<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#1F497D'>Hello Everyone,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#1F497D'>I didn&#8217;t get a reply to my problem below so I&#8217;m posting again just in case someone who might be able to help missed my previous post.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#1F497D'>Thank You&#8230;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>*************************************************************************************</span><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>Hello list,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>I&#8217;m trying to populate my CDR logs with values which are available after the call has started (e.g. signalling IP of remote user, media IP, codec etc.). While CHANNEL function give me all I need for the incoming leg (leg A), I can&#8217;t get the relevant values for the outgoing channel. I&#8217;ve tried using the option &#8216;U&#8217; with my dial command (execute subroutine for called channel after called channel answered but before the call is bridged). While this throws the correct information to the console it does not populate the CDRs accordingly.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>Note: Asterisk ver is 1.8.7.1 and CDR&#8217;s are written to MySQL with adaptive ODBC and the table therein contains the relevant fields.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>This is the console with &#8216;very-verbose&#8217; output for the &#8216;Dial&#8217; application where office_Admin2, IP 192.168.20.222, is calling office_ServerRoom, IP 192.168.20.226. My comments added prefixed by ** and on separate line:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>** channel here is source channel: SIP/office_Admin2-00000015<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:31]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [316@InternalDP:5] Dial(&quot;SIP/office_Admin2-00000015&quot;, &quot;SIP/office_ServerRoom,,FgU(jump2SetVar)&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:31]&nbsp;&nbsp; == Using UDPTL CoS mark 5<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:31]&nbsp;&nbsp; == Using SIP RTP CoS mark 5<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:31]&nbsp;&nbsp;&nbsp;&nbsp; -- Called SIP/office_ServerRoom<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:31]&nbsp;&nbsp;&nbsp;&nbsp; -- SIP/office_ServerRoom-00000016 is ringing<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:31]&nbsp;&nbsp;&nbsp;&nbsp; -- SIP/office_ServerRoom-00000016 is ringing<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- SIP/office_ServerRoom-00000016 answered SIP/office_Admin2-00000015<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>** from here the channel is the destination channel: SIP/office_ServerRoom-00000016<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [s@jump2SetVar:1] Gosub(&quot;SIP/office_ServerRoom-00000016&quot;, &quot;SetVar,postdial,1&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>** This is how I obtain channel information:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>** exten =&gt; postdial,1,Set(CDR(chanoutsigip)=${CHANNEL(peerip)}:${SIPPEER(${CHANNEL(peername)},port)})</span><span lang=EN-GB style='font-family:"Cambria","serif";color:#1F497D'> ; resulting format: &lt;a.b.c.d&gt;:&lt;port&gt;</span><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>** same =&gt; n,Set(CDR(chanoutmediaip)=${CHANNEL(rtpdest,audio)})<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>** same =&gt; n,Set(CDR(chanoutcodec)=${CHANNEL(audionativeformat)})<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [postdial@SetVar:1] Set(&quot;SIP/office_ServerRoom-00000016&quot;, &quot;CDR(chanoutsigip)=192.168.20.226:5065&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [postdial@SetVar:2] Set(&quot;SIP/office_ServerRoom-00000016&quot;, &quot;CDR(chanoutmediaip)=192.168.20.226:23008&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [postdial@SetVar:3] Set(&quot;SIP/office_ServerRoom-00000016&quot;, &quot;CDR(chanoutcodec)=g729&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [postdial@SetVar:4] Goto(&quot;SIP/office_ServerRoom-00000016&quot;, &quot;endsub,1&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Goto (SetVar,endsub,1)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [endsub@SetVar:1] Return(&quot;SIP/office_ServerRoom-00000016&quot;, &quot;&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [s@jump2SetVar:2] Return(&quot;SIP/office_ServerRoom-00000016&quot;, &quot;&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Executing [s@app_dial_gosub_virtual_context:1] NoOp(&quot;SIP/office_ServerRoom-00000016&quot;, &quot;&quot;) in new stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Auto fallthrough, channel 'SIP/office_ServerRoom-00000016' status is 'UNKNOWN'<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>[Dec&nbsp; 1 12:14:33]&nbsp;&nbsp;&nbsp;&nbsp; -- Remotely bridging SIP/office_Admin2-00000015 and SIP/office_ServerRoom-00000016<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>When call is terminated the relevant fields in the database for CDR(chanoutsigip), CDR(chanoutmediaip) and CDR(chanoutcodec) are populated with their default values (typically blank or &#8216;-----&#8216;) and NOT with the values above.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>Am I doing something wrong or is there a different way to populate CDR&#8217;s with info from called channel (leg B)?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>Thank you for your replies&#8230;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-family:"Cambria","serif";color:#000066'>Harel<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p>&nbsp;</o:p></span></p></div></body></html>