Problems with pjsip contact

Hi,

I have a problem with contacts, from my pjsip accounts. When you register an endpoint, the contact is created and then deleted.

    -- Added contact 'sip:1000@192.168.72.229:51020;user=phone;transport=tcp' to AOR '1000' with expiration of 3600 seconds
    -- Contact 1000/sip:1000@192.168.72.229:51020;user=phone;transport=tcp is now Unknown.
  == Endpoint 1000 is now Reachable
  == Contact 1000/sip:1000@192.168.72.229:51020;user=phone;transport=tcp has been deleted
  == Endpoint 1000 is now Unreachable

my configuration of sorcery and extconfig is as follows

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

[res_pjsip_endpoint_identifier_ip]
identify=realtime,ps_endpoint_id_ips

[res_pjsip_outbound_registration]
registration=realtime,ps_registration

[settings]
ps_endpoints => odbc,asterisk
ps_aors => odbc,asterisk
ps_auths => odbc,asterisk
ps_domain_aliases => odbc,asterisk
ps_endpoint_id_ips => odbc,asterisk
ps_contacts => odbc,asterisk
ps_globals => odbc,asterisk
ps_registrations => odbc,asterisk
ps_subscription_persistence => odbc,asterisk
ps_systems =>  odbc,asterisk,ps_systems
ps_transports => odbc,asterisk,ps_transports
extensions => odbc,asterisk,extensions
voicemail => odbc,asterisk,voicemails
realtime_extensions => odbc,asterisk,extensions
realtime_ivr => odbc,asterisk,numivr
meetme => mysql,general
queues => odbc,asterisk
queue_members => odbc,asterisk
queue_rules => odbc,asterisk
musiconhold => odbc,asterisk,musiconholds
queue_log => odbc,asterisk
;http => odbc,asterisk
;manager.conf => odbc,asterisk,managers
ari.conf =>  odbc,asterisk,aris
acls => odbc,asterisk,acl_pbx
agent => odbc,asterisk
extensions_ivr_ara.conf => odbc,asterisk,contexto_ivr
extensions_did_ara.conf => odbc,asterisk,contexto_did
extensions_companys_ara.conf => odbc,asterisk,contexto_company
extensions_queues_ara.conf => odbc,asterisk,contexto_queue
extensions_ext_ara.conf => odbc,asterisk,contexto_ext
extensions_action_ara.conf => odbc,asterisk,contexto_acc

If I comment in sorcery.conf the line of contact

;contact=realtime,ps_contacts

so the contacts work but I can’t have them in the mysql table

pbx*CLI> pjsip show endpoints

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  1000                                                 Not in use    0 of inf
     InAuth:  1000/1000
        Aor:  1000                                               1
      Contact:  1000/sip:1000@192.168.72.229:50451;user=ph 0f089162e1 Unknown         nan
  Transport:  transport-tcp             tcp      0      0  0.0.0.0:5060

Didn’t you have a post previously about this where you said the table schema or something was incorrect? Did that prove to be untrue? What is the schema of it currently.

no, I had a problem with the realtime of ps_registrations, which turned out to be a problem in the table, I had a field that was wrong, a fault of mine, for touching it.

To generate the database I used Alembic. The database is MySQL,
The table that fails me is that of ps_contacts.

CREATE TABLE ps_contacts (
id varchar(255) DEFAULT NULL,
uri varchar(255) DEFAULT NULL,
expiration_time bigint(20) DEFAULT NULL,
qualify_frequency int(11) DEFAULT NULL,
outbound_proxy varchar(40) DEFAULT NULL,
path text,
user_agent varchar(255) DEFAULT NULL,
qualify_timeout float DEFAULT NULL,
reg_server varchar(20) DEFAULT NULL,
authenticate_qualify enum(‘yes’,‘no’) DEFAULT NULL,
via_addr varchar(40) DEFAULT NULL,
via_port int(11) DEFAULT NULL,
call_id varchar(255) DEFAULT NULL,
endpoint varchar(40) DEFAULT NULL,
prune_on_boot enum(‘yes’,‘no’) DEFAULT NULL,
UNIQUE KEY id (id),
UNIQUE KEY ps_contacts_uq (id,reg_server),
KEY ps_contacts_id (id),
KEY ps_contacts_qualifyfreq_exp (qualify_frequency,expiration_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

In my opinion I don’t think it’s from the tables, because I haven’t altered it

thank you very much @jcolp

If you use UDP does the result change at all? What version of Asterisk?

He tried with udp and with wss as transport. But the contact still fails.
I’m using Asterisk 15.7.3 version

I’d suggest upgrading to a supported version, as if the problem still exists and is a bug it will not be fixed in 15.

What version would you recommend me?

Asterisk 16 is a current supported LTS[1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions

cool, I’m going to porbar with 16.
Thank you very much for all @jcolp!
good weekend

Hi,
I created a new installation with version 16.5.1
But I continue with the same problem, I’m going crazy, I have configured realtime for pjsip but it gives me the same problem. When the contacts of my pjsip accounts are created, when I launch the “pjsip show endpoints” command, the contacts are deleted,
if I comment on sorcery.conf the line
;contact=realitme,ps_contacts
The contacts are created, obviously I don’t see them in the ps_contacts table, but when I launch the “pjsip show endpoints” command, the contact appears correctly and it works correctly.

this is my configuration

[res_pjsip] ; Realtime PJSIP configuration wizard
endpoint=config,pjsip.conf,criteria=type=endpoint ; Load outbound addresses from configuration file.
endpoint=realtime,ps_endpoints
auth=realtime,ps_auths
aor=realtime,ps_aors
domain_alias=realtime,ps_domain_aliases
;contact=realtime,ps_contacts

[res_pjsip_endpoint_identifier_ip]
identify=realtime,ps_endpoint_id_ips

[res_pjsip_outbound_registration]
registration=realtime,ps_registrations

[settings]
ps_endpoints => odbc,asterisk
ps_auths => odbc,asterisk
ps_aors => odbc,asterisk
ps_domain_aliases => odbc,asterisk
ps_endpoint_id_ips => odbc,asterisk
ps_outbound_publishes => odbc,asterisk
ps_contacts => odbc,asterisk
ps_registrations => odbc,asterisk
ps_inbound_publications = odbc,asterisk
ps_asterisk_publications = odbc,asterisk
extensions => odbc,asterisk,extensions
voicemail => odbc,asterisk,voicemails
realtime_extensions => odbc,asterisk,extensions
realtime_ivr => odbc,asterisk,numivr
meetme => mysql,general
queues => odbc,asterisk
queue_members => odbc,asterisk
queue_rules => odbc,asterisk
musiconhold => odbc,asterisk,musiconholds
queue_log => odbc,asterisk
http => odbc,asterisk
manager.conf => odbc,asterisk,managers
ari.conf => odbc,asterisk,aris
acls => odbc,asterisk,acl_pbx
agent => odbc,asterisk
extensions_dinamic.conf => odbc,asterisk,dialplan
extensions_ivr_ara.conf => odbc,asterisk,ivr
extensions_geograficos_ara.conf => odbc,asterisk,geograficos
extensions_empresa_servicios_ara.conf => odbc,asterisk,empresa_servicios
extensions_colas_ara.conf => odbc,asterisk,colas
extensions_usuarios_ara.conf => odbc,asterisk,usuarios

pjsip.conf
[transport-tcp]
type = transport
protocol = tcp
bind = 0.0.0.0:5060
local_net = 192.168.72.0/24

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060
;local_net = 192.168.72.0/24

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

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

Hi,

I think I have found the solution.
After several tests, probe with several ODBC drivers, it turns out that with Verison 8.8 libmyodbc8 (yum install mysql-connector-odbc) the realtime of the ps_contact table does not work correctly (
at least for me). I change to a verison earlier than 8.0 (5.3) and the problem was fixed. I have discarded the verison the odbc from this page.

https://downloads.mysql.com/archives/c-odbc/

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.