[Freeswitch-users] How to get call uuid from b-leg and insert to pgsql

Marcel Haldemann marcel.haldemann at convercom.ch
Tue Jul 9 13:12:51 UTC 2019


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 at lists.freeswitch.org> Im Auftrag von Brian West
Gesendet: Dienstag, 9. Juli 2019 14:33
An: FreeSWITCH Users Help <freeswitch-users at 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 at gmail.com<mailto:cong.wang.itsherpa at 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 at TEST-FS> uuid_getvar 67534e60-fc91-4e6b-b64e-868d5f3d8b16 call_uuid
67534e60-fc91-4e6b-b64e-868d5f3d8b16

freeswitch at 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 at freeswitch.com<mailto:sales at 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 at lists.freeswitch.org<mailto:FreeSWITCH-users at 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 at freeswitch.com<mailto:sales at freeswitch.com>

FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045<https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g>

Email: brian at freeswitch.com<mailto:brian at freeswitch.com>

Mobile: 918-424-9378

Website: https://www.FreeSWITCH.com<https://www.freeswitch.com/>

[https://www.facebook.com/signalwireinc?src=email]<https://www.facebook.com/freeswitch>[https://twitter.com/freeswitch]<https://twitter.com/freeswitch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20190709/228ebda2/attachment-0001.html>


More information about the FreeSWITCH-users mailing list