freeswitch icon indicating copy to clipboard operation
freeswitch copied to clipboard

Output the SIP call-id with the FreeSWITCH logs

Open khou opened this issue 6 years ago • 2 comments

I'm trying to correlate FreeSWITCH application logs with SIP I'm capturing using Heplify.

If possible, an enhancement to logging where the call-id is logged with each line of the application log would make it much easier to identify what occurs in FreeSWITCH for a specific call.

I've attempted this with channel UUID and capturing the CDR, then correlating the SIP with the CDR, but as you can see, this is an extensive workaround and requires lots of custom logic.

Desired output sample:

2020-09-01T20:33:58Z INFO HEP packet:{Version:2,Protocol:17,SrcIP:192.168.63.171,DstIP:192.168.63.6,SrcPort:15060,DstPort:41963,Tsec:1598992438,Tmsec:270403,ProtoType:1,NodeID:2002,NodePW:,CID:,Vlan:0} with Payload:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.63.6:41963;rport=41963;branch=z9hG4bKPj2911369f-24eb-4731-b915-7cde4dbfa3b9
From: <sip:1018@freeswitch-internal>;tag=cba407e1-3d14-497f-97b2-c0efae925577
To: <sip:1019@freeswitch-internal>;tag=v2K9tQpaUrQKj
Call-ID: dedf359c-fd65-4df4-a512-1b05747a1b6d
CSeq: 9211 BYE
User-Agent: FreeSWITCH-mod_sofia/1.10.2-release-14-f7bdd3845a~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0
Session-ID: 00000000000000000000000000000000

dedf359c-fd65-4df4-a512-1b05747a1b6d 2020-09-01 20:33:58.252944 [INFO] sofia_glue.c:545 Setting "Session-ID: 058092b0134449418b09e2df389e06a5" from partner leg
dedf359c-fd65-4df4-a512-1b05747a1b6d 2020-09-01 20:33:58.252944 [WARNING] sofia_glue.c:588 Session-ID: Fallback to RFC7329
dedf359c-fd65-4df4-a512-1b05747a1b6d 2020-09-01 20:33:58.252944 [NOTICE] sofia.c:1089 Hangup sofia/internal/1018@freeswitch-internal [CS_EXECUTE] [NORMAL_CLEARING]
dedf359c-fd65-4df4-a512-1b05747a1b6d 2020-09-01 20:33:58.252944 [DEBUG] switch_ivr_bridge.c:823 sofia/internal/1018@freeswitch-internal ending bridge by request from write function

This applies to all versions of FreeSWITCH

khou avatar Sep 01 '20 21:09 khou

for inbound calls, you can just log the call id when INVITE is received. for outbound calls, enable use-uuid-as-call-id in sip profile should be enough.

suggest add call-id to the following log line e.g.

d9edda4b-52c5-49f0-a22e-94ab45418777 2020-09-02 16:14:10.639073 [DEBUG] sofia.c:10324 sofia/default/[email protected] receiving invite from 172.22.0.1:48789 version: 1.10.4-dev git 9a78d18 2020-08-20 07:07:29Z 64bit call-id: xxxx

seven1240 avatar Sep 02 '20 08:09 seven1240

see https://github.com/signalwire/freeswitch/pull/1034/files

seven1240 avatar Jan 19 '21 03:01 seven1240