Asterisk Crashes using Realtime and trying to make a call with res_pjsip.so: undefined symbol: pjsip_dlg_create_uas

Hi all

I am pretty new to Asterisk, and I am currently testing with Asterisk in realtime via ODBC to Maria-DB, and PJSIP.

I have set up 2 extensions, but if I try and make a call to the other extension, or indeed make a call to anything, then asterisk crashes on me.

Here is my /etc/odbc.ini

[Asterisk]
Description =MySQL connection to Asterisk Database
Driver =MySQL
Database =asterisk
Server =localhost
UserName =myusername
Password =mypassword
Port =3306
Socket =/var/lib/mysql/mysql.sock

Here is my /etc/asterisk/res_odbc.conf

[asterisk]
enabled => yes
dsn => Asterisk
username => myusername
password => mypassword
pre-connect => yes
max_connections => 1

/etc/asterisk/modules.conf

[modules]
autoload=yes
preload => res_odbc.so
preload => res_config_odbc.so
noload => chan_alsa.so
noload => chan_console.so
noload => chan_sip.so

/etc/asterisk/extconfig.conf

[settings]
queues => odbc,asterisk,queues
queue_members => odbc,asterisk,queue_members
queue_rules => odbc,asterisk,queue_rules
voicemail => odbc,asterisk,voicemail
extensions => odbc,asterisk,extensions
musiconhold => odbc,asterisk,musiconhold
ps_endpoints => odbc,asterisk,ps_endpoints
ps_auths => odbc,asterisk,ps_auths
ps_aors => odbc,asterisk,ps_aors
ps_domain_aliases => odbc,asterisk,ps_domain_aliases
ps_endpoint_id_ips => odbc,asterisk,ps_endpoint_id_ips
ps_contacts => odbc,asterisk,ps_contacts

/etc/asterisk/sorcery.conf

[res_pjsip]
endpoint=realtime,ps_endpoints
auth=realtime,ps_auths
aor=realtime,ps_aors
domain_alias=realtime,ps_domain_aliases
identify=realtime,ps_endpoint_id_ips
contact=realtime,ps_contacts

/etc/asterisk/pjsip.conf

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

/etc/asterisk/extensions.conf

[testing]
switch => Realtime

Database

SELECT * FROM ps_aors

“id” “contact” “default_expiration” “mailboxes” “max_contacts” “minimum_expiration” “remove_existing” “qualify_frequency” “authenticate_qualify” “maximum_expiration” “outbound_proxy” “support_path” “qualify_timeout” “voicemail_extension”
“101” \N \N \N “1” \N \N \N \N \N \N \N \N \N
"102" \N \N \N “1” \N \N \N \N \N \N \N \N \N

SELECT * FROM ps_auths

“id” “auth_type” “nonce_lifetime” “md5_cred” “password” “realm” “username”
“101” “userpass” \N \N “101” \N "101"
“102” “userpass” \N \N “102” \N “102”

SELECT * FROM ps_endpoints

“id” “transport” “aors” “auth” “context” “disallow” “allow” “direct_media” “connected_line_method” “direct_media_method” “direct_media_glare_mitigation” “disable_direct_media_on_nat” “dtmf_mode” “external_media_address” “force_rport” “ice_support” “identify_by” “mailboxes” “moh_suggest” “outbound_auth” “outbound_proxy” “rewrite_contact” “rtp_ipv6” “rtp_symmetric” “send_diversion” “send_pai” “send_rpid” “timers_min_se” “timers” “timers_sess_expires” “callerid” “callerid_privacy” “callerid_tag” “100rel” “aggregate_mwi” “trust_id_inbound” “trust_id_outbound” “use_ptime” “use_avpf” “media_encryption” “inband_progress” “call_group” “pickup_group” “named_call_group” “named_pickup_group” “device_state_busy_at” “fax_detect” “t38_udptl” “t38_udptl_ec” “t38_udptl_maxdatagram” “t38_udptl_nat” “t38_udptl_ipv6” “tone_zone” “language” “one_touch_recording” “record_on_feature” “record_off_feature” “rtp_engine” “allow_transfer” “allow_subscribe” “sdp_owner” “sdp_session” “tos_audio” “tos_video” “sub_min_expiry” “from_domain” “from_user” “mwi_from_user” “dtls_verify” “dtls_rekey” “dtls_cert_file” “dtls_private_key” “dtls_cipher” “dtls_ca_file” “dtls_ca_path” “dtls_setup” “srtp_tag_32” “media_address” “redirect_method” “set_var” “cos_audio” “cos_video” “message_context” “force_avp” “media_use_received_transport” “accountcode” “user_eq_phone” “moh_passthrough” “media_encryption_optimistic” “rpid_immediate” “g726_non_standard” “rtp_keepalive” “rtp_timeout” “rtp_timeout_hold” “bind_rtp_to_media_address” “voicemail_extension” “mwi_subscribe_replaces_unsolicited” “deny” “permit” “acl” “contact_deny” “contact_permit” “contact_acl” “subscribe_context” “fax_detect_timeout” “contact_user”
“101” “transport-udp” “101” “101” “testing” “all” “g722” “yes” \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
"102" “transport-udp” “102” “102” “testing” “all” “g722” “yes” \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N

SELECT * FROM extensions

“id” “context” “exten” “priority” “app” “appdata”
“3” “testing” “_1XX” “1” “NoOP” “”
“4” “testing” “_1XX” “2” “Dial” “PJSIP/${EXTEN}”

I am able to register correctly with phones 101 and 102, if I run a pjsip show endpoints, I get (with 101 registered):

Endpoint: <Endpoint/CID…> <State…> <Channels.>
I/OAuth: <AuthId/UserName…>
Aor: <Aor…>
Contact: <Aor/ContactUri…> <Hash…> <RTT(ms)…>
Transport: <TransportId…> <BindAddress…>
Channel: <ChannelId…> <State…> <Time…>
Exten: <DialedExten…> CLCID: <ConnectedLineCID…>

Endpoint: 101 Not in use 0 of inf
InAuth: 101/101
Aor: 101 1
Contact: 101/sip:101@10.5.0.55:51748;rinstance=fde2 35afdbd6d6 Unknown nan
Transport: transport-udp udp 0 0 0.0.0.0:5060

Endpoint: 102 Unavailable 0 of inf
InAuth: 102/102
Aor: 102 1
Transport: transport-udp udp 0 0 0.0.0.0:5060

Make a call from Endpoint: 101 to 333 (anything dialled is the same including the other extension) in this case (with pjsip logging on)

<— Received SIP request (872 bytes) from UDP:10.5.0.55:51748 —>
INVITE sip:333@10.5.0.100 SIP/2.0
Via: SIP/2.0/UDP 10.5.0.55:51748;branch=z9hG4bK-524287-1—43c7443c93978966;rport
Max-Forwards: 70
Contact: sip:101@10.5.0.55:51748;rinstance=fde2efa632e84760
To: sip:333@10.5.0.100
From: sip:101@10.5.0.100;tag=b306375f
Call-ID: 82167YzdhOTJhOGNiYjE3NDI0NzM5NGM2NzljYjQ4YjMyN2Y
CSeq: 1 INVITE
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, OPTIONS, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite release 4.9.6 stamp 82167
Content-Length: 327

v=0
o=- 1478613164342661 1 IN IP4 10.5.0.55
s=X-Lite release 4.9.6 stamp 82167
c=IN IP4 10.5.0.55
t=0 0
m=audio 62222 RTP/AVP 9 8 120 0 84 101
a=rtpmap:120 opus/48000/2
a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
a=rtpmap:84 speex/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv

<— Transmitting SIP response (514 bytes) to UDP:10.5.0.55:51748 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.5.0.55:51748;rport=51748;received=10.5.0.55;branch=z9hG4bK-524287-1—43c7443c93978966
Call-ID: 82167YzdhOTJhOGNiYjE3NDI0NzM5NGM2NzljYjQ4YjMyN2Y
From: sip:101@10.5.0.100;tag=b306375f
To: sip:333@10.5.0.100;tag=z9hG4bK-524287-1—43c7443c93978966
CSeq: 1 INVITE
WWW-Authenticate: Digest realm=“asterisk”,nonce=“1478613165/c1887fdebc05b65a21de54260790f803”,opaque=“505058482997f9e3”,algorithm=md5,qop="auth"
Server: Asterisk PBX 14.1.0
Content-Length: 0

<— Received SIP request (333 bytes) from UDP:10.5.0.55:51748 —>
ACK sip:333@10.5.0.100 SIP/2.0
Via: SIP/2.0/UDP 10.5.0.55:51748;branch=z9hG4bK-524287-1—43c7443c93978966;rport
Max-Forwards: 70
To: sip:333@10.5.0.100;tag=z9hG4bK-524287-1—43c7443c93978966
From: sip:101@10.5.0.100;tag=b306375f
Call-ID: 82167YzdhOTJhOGNiYjE3NDI0NzM5NGM2NzljYjQ4YjMyN2Y
CSeq: 1 ACK
Content-Length: 0

<— Received SIP request (1151 bytes) from UDP:10.5.0.55:51748 —>
INVITE sip:333@10.5.0.100 SIP/2.0
Via: SIP/2.0/UDP 10.5.0.55:51748;branch=z9hG4bK-524287-1—affb0f2f36c01372;rport
Max-Forwards: 70
Contact: sip:101@10.5.0.55:51748;rinstance=fde2efa632e84760
To: sip:333@10.5.0.100
From: sip:101@10.5.0.100;tag=b306375f
Call-ID: 82167YzdhOTJhOGNiYjE3NDI0NzM5NGM2NzljYjQ4YjMyN2Y
CSeq: 2 INVITE
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, OPTIONS, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite release 4.9.6 stamp 82167
Authorization: Digest username=“101”,realm=“asterisk”,nonce=“1478613165/c1887fdebc05b65a21de54260790f803”,uri=“sip:333@10.5.0.100”,response=“702385f3175410acdc75d9f258d0a466”,cnonce=“4245be740e39200ca71adef7df049736”,nc=00000001,qop=auth,algorithm=md5,opaque="505058482997f9e3"
Content-Length: 327

v=0
o=- 1478613164342661 1 IN IP4 10.5.0.55
s=X-Lite release 4.9.6 stamp 82167
c=IN IP4 10.5.0.55
t=0 0
m=audio 62222 RTP/AVP 9 8 120 0 84 101
a=rtpmap:120 opus/48000/2
a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
a=rtpmap:84 speex/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv

voip001*CLI>
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups

so as you can see Asterisk crashes, I am running Asterisk 14.1.0

I have also ran Asterisk will full logging, and the error I get is:

asterisk: symbol lookup error: /usr/lib64/asterisk/modules/res_pjsip.so: undefined symbol: pjsip_dlg_create_uas

Can anyone help me with what I have done wrong? I cannot seem to find much assistance on this error online?

Thanks

How exactly have you built and installed Asterisk, and PJSIP?

It is installed as per the instructions at http://www.voip-info.org/wiki/view/Asterisk+11+Installation+on+CentOS+6 but obviously using asterisk 14 and cent os 7

And what about PJSIP?

I think I just used the install_prereq script

I reinstalled this time using ./configure --with-pjproject-bundled and it’s now all working, thanks for pointing me in the right direction :slight_smile:

Seems I’ve hit almost similar issue on asterisk 16 after 4 years, but on chan_sip ( if it realy depends from chan driver) !!
may be it not related, but problem looks almost same:

Debian 9, Asterisk 17.6.0 installed form sources using usually commands:
./configure && make menuselect && make && make install

test-callcenter*CLI> dialplan show  internal-features
[ Context 'internal-features' created by 'pbx_config' ]
  Alt. Switch =>    'Realtime/'                                   [pbx_config]
mysql> select * from t_extensions;
+-----+-----------+------+---------+-------------+------------------------+-------+----------+-------+------------------------+
| id  | tenant_id | type | subtype | description | context                | exten | priority | app   | appdata                |
+-----+-----------+------+---------+-------------+------------------------+-------+----------+-------+------------------------+
| 442 |        61 |    3 |       0 | test        | internal-features | *600  |        1 | Gosub | app-echo,s,1(${EXTEN}) |
+-----+-----------+------+---------+-------------+------------------------+-------+----------+-------+------------------------+
1 row in set (0.00 sec)

/etc/asterisk/extconfig.conf :

extensions => mysql,pbxdb,t_extensions


[app-echo]
exten => s,1,Answer()
exten => s,n,Playback(demo-echotest) ; Let them know what’s going on
exten => s,n,Echo() ; Do the echo test
exten => s,n,Playback(demo-echodone) ; Let them know it’s over

Now, I call to *600

[backup]root@test-callcenter:asterisk# rasterisk 
Asterisk 17.6.0, Copyright (C) 1999 - 2018, Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 17.6.0 currently running on test-callcenter (pid = 17937)
Core debug is still 1.


<--- SIP read from UDP:192.168.201.151:5060 --->
INVITE sip:*600@192.168.201.199 SIP/2.0
Via: SIP/2.0/UDP 192.168.201.151;rport;branch=z9hG4bKqqskbejb
Max-Forwards: 70
To: <sip:*600@192.168.201.199>
From: "George" <sip:101@192.168.201.199>;tag=uhxjd
Call-ID: kpdrwrmuquzslua@Browny
CSeq: 105 INVITE
Contact: <sip:101@192.168.201.151>
Content-Type: application/sdp
Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,REFER,NOTIFY,SUBSCRIBE,INFO,MESSAGE
Supported: replaces,norefersub,100rel
User-Agent: Twinkle/1.10.1
Content-Length: 315

v=0
o=twinkle 1915425761 2058001673 IN IP4 192.168.201.151
s=-
c=IN IP4 192.168.201.151
t=0 0
m=audio 8000 RTP/AVP 98 97 8 0 3 101
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
<------------->
--- (13 headers 14 lines) ---
Sending to 192.168.201.151:5060 (no NAT)
Sending to 192.168.201.151:5060 (no NAT)
Using INVITE request as basis request - kpdrwrmuquzslua@Browny
Found peer '101' for '101' from 192.168.201.151:5060

<--- Reliably Transmitting (NAT) to 192.168.201.151:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.201.151;branch=z9hG4bKqqskbejb;received=192.168.201.151;rport=5060
From: "George" <sip:101@192.168.201.199>;tag=uhxjd
To: <sip:*600@192.168.201.199>;tag=as25f656f0
Call-ID: kpdrwrmuquzslua@Browny
CSeq: 105 INVITE
Server: Asterisk PBX 17.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="0dc665b8"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog 'kpdrwrmuquzslua@Browny' in 6400 ms (Method: INVITE)

<--- SIP read from UDP:192.168.201.151:5060 --->
ACK sip:*600@192.168.201.199 SIP/2.0
Via: SIP/2.0/UDP 192.168.201.151;rport;branch=z9hG4bKqqskbejb
Max-Forwards: 70
To: <sip:*600@192.168.201.199>;tag=as25f656f0
From: "George" <sip:101@192.168.201.199>;tag=uhxjd
Call-ID: kpdrwrmuquzslua@Browny
CSeq: 105 ACK
User-Agent: Twinkle/1.10.1
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---

<--- SIP read from UDP:192.168.201.151:5060 --->
INVITE sip:*600@192.168.201.199 SIP/2.0
Via: SIP/2.0/UDP 192.168.201.151;rport;branch=z9hG4bKpoehbzkv
Max-Forwards: 70
To: <sip:*600@192.168.201.199>
From: "George" <sip:101@192.168.201.199>;tag=uhxjd
Call-ID: kpdrwrmuquzslua@Browny
CSeq: 106 INVITE
Contact: <sip:101@192.168.201.151>
Content-Type: application/sdp
Authorization: Digest username="101",realm="asterisk",nonce="0dc665b8",uri="sip:*600@192.168.201.199",response="3aba3948596e96109d8641d5bc338ec6",algorithm=MD5
Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,REFER,NOTIFY,SUBSCRIBE,INFO,MESSAGE
Supported: replaces,norefersub,100rel
User-Agent: Twinkle/1.10.1
Content-Length: 315

v=0
o=twinkle 1915425761 2058001673 IN IP4 192.168.201.151
s=-
c=IN IP4 192.168.201.151
t=0 0
m=audio 8000 RTP/AVP 98 97 8 0 3 101
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
<------------->
--- (14 headers 14 lines) ---
Sending to 192.168.201.151:5060 (NAT)
Using INVITE request as basis request - kpdrwrmuquzslua@Browny
Found peer '101' for '101' from 192.168.201.151:5060
  == Using SIP RTP CoS mark 5
Got SDP version 2058001673 and unique parts [twinkle 1915425761 IN IP4 192.168.201.151]
Found RTP audio format 98
Found RTP audio format 97
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 3
Found RTP audio format 101
Found audio description format speex for ID 98
Found audio description format speex for ID 97
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format GSM for ID 3
Found audio description format telephone-event for ID 101
Capabilities: us - (ulaw|alaw|gsm|h263), peer - audio=(ulaw|gsm|alaw|speex|speex16)/video=(nothing)/text=(nothing), combined - (ulaw|alaw|gsm)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 192.168.201.151:8000
Looking for *600 in internal-features (domain 192.168.201.199)
sip_route_dump: route/path hop: <sip:101@192.168.201.151>

<--- Transmitting (NAT) to 192.168.201.151:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.201.151;branch=z9hG4bKpoehbzkv;received=192.168.201.151;rport=5060
From: "George" <sip:101@192.168.201.199>;tag=uhxjd
To: <sip:*600@192.168.201.199>
Call-ID: kpdrwrmuquzslua@Browny
CSeq: 106 INVITE
Server: Asterisk PBX 17.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:*600@192.168.201.202:5060>
Content-Length: 0


<------------>
    -- Executing [*600@internal-features:1] Gosub("SIP/101-00000019", "app-echo,s,1(*600)")
test-callcenter*CLI> 
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups
Asterisk ending (0).
[backup]root@test-callcenter:asterisk#

And asterisk dies!! but sometimes first call works, second - asterisk crashed! so its not smth static .

When I remove the line “extensions => mysql,pbxdb,t_extensions” from the /etc/asterisk/extconfig.conf, and create extension *600 with echo test, all works without issues !

[internal-features]
exten => *600,1,Answer()
 same => n,Echo()

reinstalled Asterisk 16.8.0 - SAME issue !
reinstalled Asterisk-18.1.1 - SAME issue !

dmesg :
[578234.111245] asterisk[12527]: segfault at 7f2790000300 ip 00007f2790000300 sp 00007f272e13ae58 error 15
[578234.111249] Code: 00 00 c0 02 00 90 27 7f 00 00 90 d8 00 90 27 7f 00 00 90 d8 00 90 27 7f 00 00 e0 02 00 90 27 7f 00 00 e0 02 00 90 27 7f 00 00 66 09 90 27 7f 00 00 f0 66 09 90 27 7f 00 00 00 03 00 90 27 7f

[backup]root@test-callcenter

continue investigation, but any help will be much appreciated!

There is a filed issue for pbx_realtime[1] and a patch up for review.

[1] https://issues.asterisk.org/jira/browse/ASTERISK-29168

I have no words, Jcolp!
Mentioned patch FIXED my problem :slight_smile:
I wonder, if the issue exists in all versions ( from 16 till 18 asterisk), why it have never been ported to production ??

it have been a month the issue started in a little callcenter, it was hard to track - since it happens only sometimes, when we dial exten which is declared in extensions.conf and in realtime config ( whithin one global context, using matching regexp ). I was not able to track what exactly was added - but cold only localize the issue.

Thank you, Jcolp! ! ! and HAPPY NEW YEAR!!

Loaded patch here and problem resolved. TY V18.1.1 on Debian 10