Short answer: use the “originator” variable on outbound calls and the “uuid” variable on inbound calls.

 

Long Answer:

 

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.

For the Call-Identification I use:

 

                if (IsOutbound())

                {

                    SessionId = GetGuidValue(vars, "originator");

                }

                else

                {

                    SessionId = GetGuidValue(vars, "uuid");

                }

 

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.

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.

 

PS: I use different tables for inbound and outbound cdrs. The outbound cdr has less rows.

 

 

Von: FreeSWITCH-users <freeswitch-users-bounces@lists.freeswitch.org> Im Auftrag von Brian West
Gesendet: Dienstag, 9. Juli 2019 14:33
An: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org>
Betreff: Re: [Freeswitch-users] How to get call uuid from b-leg and insert to pgsql

 

Your best bet is to use XML CDR and post process it.

 

On Tue, Jul 9, 2019 at 4:45 AM 王聡 <cong.wang.itsherpa@gmail.com> wrote:

Hi all,

 

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.

 

A channel variable “variable_call_uuid” seems good to record, and I confirmed it is the correct call uuid in fs_cli by:

 

freeswitch@TEST-FS> uuid_getvar 67534e60-fc91-4e6b-b64e-868d5f3d8b16 call_uuid

67534e60-fc91-4e6b-b64e-868d5f3d8b16

 

freeswitch@TEST-FS> uuid_getvar 2ab39a17-2f8d-4ac1-81de-b32a990e55c1 call_uuid

67534e60-fc91-4e6b-b64e-868d5f3d8b16

 

However, when I tried to record this variable into pgsql, it turned into channels uuid in pgsql.

The followings had added into cdr_pg_csv.conf.xml:

 

    <field var="call_uuid”/>

 

But pgsql record showed:

 

SELECT call_uuid FROM cdr where uuid = '67534e60-fc91-4e6b-b64e-868d5f3d8b16’;

> 67534e60-fc91-4e6b-b64e-868d5f3d8b16

 

SELECT call_uuid FROM cdr where uuid = '2ab39a17-2f8d-4ac1-81de-b32a990e55c1’;

> 2ab39a17-2f8d-4ac1-81de-b32a990e55c1 # Which should be 67534e60-fc91-4e6b-b64e-868d5f3d8b16

 

Any idea or advice on this issue?

 

Regards.

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com


 

--

 

Brian West | Co-founder and Developer

Need Commercial support? email sales@freeswitch.com

FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045

Email: brian@freeswitch.com

Mobile: 918-424-9378

Website: https://www.FreeSWITCH.com

https://www.facebook.com/signalwireinc?src=emailhttps://twitter.com/freeswitch