<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
        {font-family:"Cambria Math";
        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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        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;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.gmail-m142440274340020314apple-tab-span
        {mso-style-name:gmail-m_142440274340020314apple-tab-span;}
span.E-MailFormatvorlage20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
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="DE-CH" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">Short answer: use the “originator” variable on outbound calls and the “uuid” variable on inbound calls.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">Long Answer:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">As Brain said, it’s the best to make a small program (I use C# .Net Core for that purpose) that parses the
 XML-CDR File.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">For the Call-Identification I use:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">               
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">if</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"> (IsOutbound())<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">                {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">                    SessionId = GetGuidValue(vars,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#A31515;mso-fareast-language:EN-US">"originator"</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">                }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">               
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">else</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">                {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">                    SessionId = GetGuidValue(vars,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#A31515;mso-fareast-language:EN-US">"uuid"</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">               
</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">So I use the “originator” variable if it is outbound (the direction), and the “uuid” variable else. I call this “session_id” in the Postgres-Database.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">This is always the same on the inbound call and on all outbound calls originated by the same inbound call, this has proven to be unique.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">PS: I use different tables for inbound and outbound cdrs. The outbound cdr has less rows.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="DE">Von:</span></b><span lang="DE"> FreeSWITCH-users <freeswitch-users-bounces@lists.freeswitch.org>
<b>Im Auftrag von </b>Brian West<br>
<b>Gesendet:</b> Dienstag, 9. Juli 2019 14:33<br>
<b>An:</b> FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org><br>
<b>Betreff:</b> Re: [Freeswitch-users] How to get call uuid from b-leg and insert to pgsql<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Your best bet is to use XML CDR and post process it.<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Jul 9, 2019 at 4:45 AM <span style="font-family:"MS Gothic"">
王聡</span> <<a href="mailto:cong.wang.itsherpa@gmail.com">cong.wang.itsherpa@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal">Hi all,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I’m trying to manage cdr in pgsql by mod_cdr_pg_csv, and I hope to record a call uuid to manage multiple recorded channels in one call.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">A channel variable “variable_call_uuid” seems good to record, and I confirmed it is the correct call uuid in fs_cli by:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">freeswitch@TEST-FS> uuid_getvar 67534e60-fc91-4e6b-b64e-868d5f3d8b16 call_uuid<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">67534e60-fc91-4e6b-b64e-868d5f3d8b16<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">freeswitch@TEST-FS> uuid_getvar 2ab39a17-2f8d-4ac1-81de-b32a990e55c1 call_uuid<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">67534e60-fc91-4e6b-b64e-868d5f3d8b16<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<p class="MsoNormal">However, when I tried to record this variable into pgsql, it turned into channels uuid in pgsql.<o:p></o:p></p>
<div>
<p class="MsoNormal">The followings had added into cdr_pg_csv.conf.xml:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<div>
<p class="MsoNormal">    <field var="call_uuid”/><o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">But pgsql record showed:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<div>
<p class="MsoNormal">SELECT call_uuid FROM cdr where uuid = '67534e60-fc91-4e6b-b64e-868d5f3d8b16’;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">> 67534e60-fc91-4e6b-b64e-868d5f3d8b16<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">SELECT call_uuid FROM cdr where uuid = '2ab39a17-2f8d-4ac1-81de-b32a990e55c1’;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">> <span style="color:#FF2600">2ab39a17-2f8d-4ac1-81de-b32a990e55c1</span><span class="gmail-m142440274340020314apple-tab-span">
</span># Which should be 67534e60-fc91-4e6b-b64e-868d5f3d8b16<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<p class="MsoNormal">Any idea or advice on this issue?<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regards.<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">_________________________________________________________________________<br>
<br>
The FreeSWITCH project is sponsored by SignalWire <a href="https://signalwire.com" target="_blank">
https://signalwire.com</a><br>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.<br>
Build your next product on our scalable cloud platform.<br>
<br>
Join our online community to chat in real time <a href="https://signalwire.community" target="_blank">
https://signalwire.community</a><br>
<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" target="_blank">https://cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" target="_blank">https://freeswitch.com</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt"><o:p> </o:p></span></p>
</div>
<div>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:4.5pt;margin-bottom:.0001pt">
<span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:black">Brian West | Co-founder and Developer</span><span style="font-size:9.5pt"><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:4.5pt;margin-bottom:.0001pt">
<span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:black">Need Commercial support? email
<a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a> </span>
<span style="font-size:9.5pt"><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:4.5pt;margin-bottom:.0001pt">
<span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:black">FreeSWITCH Solutions |
<a href="https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g" target="_blank">
<span style="color:#1155CC">17345 Civic Drive #2531 Brookfield, WI 53045</span></a></span><span style="font-size:9.5pt"><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:4.5pt;margin-bottom:.0001pt">
<span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:black">Email: </span>
<span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#1155CC"><a href="mailto:brian@freeswitch.com" target="_blank">brian@freeswitch.com</a></span><span style="font-size:9.5pt"><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:4.5pt;margin-bottom:.0001pt">
<span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:black">Mobile: 918-424-9378</span><span style="font-size:9.5pt"><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:4.5pt;margin-bottom:.0001pt">
<span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:black">Website:
</span><span style="font-size:9.5pt;color:black"><a href="https://www.freeswitch.com/" target="_blank"><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#1155CC">https://www.FreeSWITCH.com</span></a></span><span style="font-size:9.5pt"><o:p></o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black"><a href="https://www.facebook.com/freeswitch" target="_blank"><span style="text-decoration:none"><img border="0" width="31" height="31" style="width:.3263in;height:.3263in" id="_x0000_i1025" src="https://lh6.googleusercontent.com/AYfRoSNaDNtMPRMevPn_GqcVEMd5NDRFi0GlluGUWzV6I5TAY_3T2-Tt0IuIXeUtEdYsgNsM8DOYKRKhjmrG_-n2Ga-LCnoNk46sO8VyEma1sBFYdiGJcLRUvkrD1CYHN79qimeg" alt="https://www.facebook.com/signalwireinc?src=email"></span></a></span><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"><a href="https://twitter.com/freeswitch" target="_blank"><span style="text-decoration:none"><img border="0" width="31" height="31" style="width:.3263in;height:.3263in" id="_x0000_i1026" src="https://lh3.googleusercontent.com/W4SqXyybH2qdAozvtoKjcz736qOjk9LHDwldvs1ahc-WVU0putVMSsUH474KDrJ32jsqi6JDjyUWxqeEkN5I1xSlC5ShYrd1b8NIMUkDzDrtbWQfa6A_90UcygqesBtRLgeFirKa" alt="https://twitter.com/freeswitch"></span></a></span><span style="font-size:9.5pt"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>