freeswitch sofia协议栈调试

freeswitch sofia协议栈调试_第1张图片

概述

freeswitch是一款简单好用的VOIP开源软交换平台。

fs内部使用sofia的sip协议栈,本文介绍如何调试跟踪sofia协议栈。

环境

centos:CentOS  release 7.0 (Final)或以上版本

freeswitch:v1.10.7

GCC:4.8.5

调试接口

sofia loglevel [0-9]

mod_sofia模块接口设置sofia sip协议栈的日志级别,0关闭调试日志,9最高包括函数调用退出流程的日志打印。

all会影响所有模块的日志级别。

tport Transport event

iptsec HTTP/SIP authentication module

nea Event engine

nta Transaction engine

nth_client HTTP Transactions Module

nth_server HTTP Transactions Module

nua User Agent engine

soa SDP Offer/Answer engine

sresolv Asynchronous DNS Resolver

stun STUN Client and Server Module

关闭sofia调试日志。

sofia loglevel all 0

测试

首先设置loglevel的级别,然后发起呼叫。

[email protected]> fsctl loglevel 6

+OK log level: INFO [6]

[email protected]> sofia loglevel all 9

Sofia log level for component [all] has been set to [9]

[email protected]> tport.c:2749 tport_wakeup_pri() tport_wakeup_pri(0x7faf98004280): events IN

tport.c:2864 tport_recv_event() tport_recv_event(0x7faf98004280)

tport.c:3205 tport_recv_iovec() tport_recv_iovec(0x7faf98004280) msg 0x7faf98009370 from (udp/10.55.55.137:5080) has 1071 bytes, veclen = 1

tport.c:3023 tport_deliver() tport_deliver(0x7faf98004280): msg 0x7faf98009370 (1071 bytes) from udp/10.55.55.138:5080/sip next=(nil)

nta.c:2880 agent_recv_request() nta: received INVITE sip:[email protected]:5080 SIP/2.0 (CSeq 72472902)

nta.c:3248 agent_aliases() nta: canonizing sip:[email protected]:5080 with contact

nta.c:3085 agent_recv_request() nta: INVITE (72472902) going to a default leg

nta.c:1348 set_timeout() nta: timer shortened to 200 ms

nua_server.c:102 nua_stack_process_request() nua: nua_stack_process_request: entering

nua_stack.c:899 nh_create() nua: nh_create: entering

nua_common.c:108 nh_create_handle() nua: nh_create_handle: entering

nua_params.c:480 nua_stack_set_params() nua: nua_stack_set_params: entering

soa.c:280 soa_clone() soa_clone(static::0x7faf98001930, 0x7faf98001130, 0x7faf9800c640) called

soa.c:403 soa_set_params() soa_set_params(static::0x7faf9800ce00, ...) called

nta.c:4417 nta_leg_tcreate() nta_leg_tcreate(0x7faf9800b180)

soa.c:1302 soa_init_offer_answer() soa_init_offer_answer(static::0x7faf9800ce00) called

soa.c:1171 soa_set_remote_sdp() soa_set_remote_sdp(static::0x7faf9800ce00, (nil), 0x7faf98009c99, 246) called

nua_dialog.c:338 nua_dialog_usage_add() nua(0x7faf9800c640): adding session usage

tport.c:3257 tport_tsend() tport_tsend(0x7faf98004280) tpn = UDP/10.55.55.138:5080

tport.c:4046 tport_resolve() tport_resolve addrinfo = 10.55.55.138:5080

tport.c:4680 tport_by_addrinfo() tport_by_addrinfo(0x7faf98004280): not found by name UDP/10.55.55.138:5080

tport.c:3594 tport_vsend() tport_vsend(0x7faf98004280): 346 bytes of 346 to udp/10.55.55.138:5080

tport.c:3492 tport_send_msg() tport_vsend returned 346

nta.c:6791 incoming_reply() nta: sent 100 Trying for INVITE (72472902)

nua_stack.c:271 nua_stack_event() nua(0x7faf9800c640): event i_invite 100 Trying

nua_session.c:4139 signal_call_state_change() nua(0x7faf9800c640): call state changed: init -> received, received offer

soa.c:1098 soa_get_remote_sdp() soa_get_remote_sdp(static::0x7faf9800ce00, [0x7faf9fffe558], [0x7faf9fffe560], [(nil)]) called

nua_stack.c:271 nua_stack_event() nua(0x7faf9800c640): event i_state 100 Trying

nua_stack.c:359 nua_application_event() nua: nua_application_event: entering

nua.c:342 nua_handle_bind() nua: nua_handle_bind: entering

2023-09-07 10:23:08.958941 [NOTICE] switch_channel.c:1104 New Channel sofia/external/[email protected] [7c4e6e50-4d25-11ee-ac94-4570ec2ca497]

nua_stack.c:359 nua_application_event() nua: nua_application_event: entering

nua.c:366 nua_handle_magic() nua: nua_handle_magic: entering

nua.c:366 nua_handle_magic() nua: nua_handle_magic: entering

nua.c:366 nua_handle_magic() nua: nua_handle_magic: entering

nua.c:366 nua_handle_magic() nua: nua_handle_magic: entering

2023-09-07 10:23:08.958941 [INFO] mod_dialplan_xml.c:637 Processing 10011 <10011>->13712345678 in context public

2023-09-07 10:23:08.958941 [NOTICE] switch_channel.c:1104 New Channel sofia/external/[email protected]:5090 [7c4ed764-4d25-11ee-ac9a-4570ec2ca497]

nua_common.c:108 nh_create_handle() nua: nh_create_handle: entering

tport.c:3257 tport_tsend() tport_tsend(0x7faf98004280) tpn = UDP/10.55.55.138:6080

tport.c:4046 tport_resolve() tport_resolve addrinfo = 10.55.55.138:6080

tport.c:4680 tport_by_addrinfo() tport_by_addrinfo(0x7faf98004280): not found by name UDP/10.55.55.138:6080

tport.c:3594 tport_vsend() tport_vsend(0x7faf98004280): 594 bytes of 594 to udp/10.55.55.138:6080

tport.c:3492 tport_send_msg() tport_vsend returned 594

nta.c:6791 incoming_reply() nta: sent 200 OK for OPTIONS (14)

nta.c:1350 set_timeout() nta: timer set to 32000 ms

nua_stack.c:569 nua_stack_signal() nua(0x7faf98011a70): recv signal r_destroy

nta.c:4470 nta_leg_destroy() nta_leg_destroy((nil))

soa.c:356 soa_destroy() soa_destroy(static::0x7faf98012400) called

[email protected]>

总结

freeswitch使用sofia sip协议栈,有需要关注sip协议栈的同学可以通过debug模式调试sip处理流程。

空空如常

求真得真

你可能感兴趣的:(技术-VOIP,voip,freeswitch,sip)