Realtime PJSIP Issues

Home » Asterisk Users » Realtime PJSIP Issues
Asterisk Users 11 Comments

We are having an issue on the latest version of asterisk when configuration PJSIP via realtime.

We do PJSIP list endpoints it shows our endpoints but lists them as invalid. When we do the PJSIP list endpoints again it shows no objects.

This applies to PJSIP list aors as well. We did not have this issue on our older asterisk 13 installs. My guess is something has changed with pjsip and realtime. Anyone have any ideas where I can start. We have tried a number of things already and would love some suggestions.

11 thoughts on - Realtime PJSIP Issues

  • This appears to be some kind of cache issue. We have been doing caching with earlier versions of asterisk 13 on the pjsip realtime, but now for some reason The items only show up the first time we use pjsip list/show and then they are wiped. I see a new full cache option and that appears to make a difference, but it is unclear what is going on. In effect it appears that items loaded from a database for pjsip must be fully cached or you can’t look up any data.

    Why has a change of this magnitude been put into an LTS?
    What is the best practices. I see in some of the wikis cache suggestions. What are others really seeing?

    Thanks

    Bryant Zimmerman (ZK Tech Inc.)
    616-855-1030 Ext. 2003

    ————————————–

  • There haven’t been any changes made except for bug fixes to the sorcery memory cache, certainly no behavior changes. In fact the implementation is the same between 13 and 14 except for a single line addition. What is your sorcery.conf for both?

  • Joshua

    That is the interesting part of it. We took our configs and database tables from our working 13.12.2 deployments and tried to use them with our new 13.17.1 deployments and we are having issues where the tables are not working. that

    There haven’t been any changes made except for bug fixes to the sorcery memory cache, certainly no behavior changes. In fact the implementation is the same between 13 and 14 except for a single line addition. What is your sorcery.conf for both?

  • You’re really throwing a lot of things in here. Please try to simplify this first and remove the caching. After that what exactly does it say it can’t find when trying to add a contact? What database is in use? Did you create the tables fresh from alembic? Upgrade existing? If you enable debug (debug to console in logger.conf and core set debug 5) does it show it doing database queries?

    As it is right now things haven’t been narrowed down enough for me to give any concrete answer or help.

  • Joshua

    We have completed more testing this morning and when we remove the realtime cache options from the sorcery file the endpoints complete registration, but we pjsip show/list does not offer any feed back at all, We also can’t send any pjsip send notify commands as they say they don’t have an endpoint there. Something has changed in the cache part of the system that is breaking the system in some manner for us with the current version and we are out of ideas.

    Thanks Bryant

    Joshua

    That is the interesting part of it. We took our configs and database tables from our working 13.12.2 deployments and tried to use them with our new 13.17.1 deployments and we are having issues where the tables are not working. that

    There haven’t been any changes made except for bug fixes to the sorcery memory cache, certainly no behavior changes. In fact the implementation is the same between 13 and 14 except for a single line addition. What is your sorcery.conf for both?

  • You’re still confusing me here. If you’ve removed the cache, then it’s not being used anymore so I don’t see how it can be a problem. If the commands aren’t listing things when you have no cache even in use then that would point to realtime, not the cache. You’d need to do as I said with debug to see what queries are being done to confirm things. You need to do troubleshooting and isolate things to determine the cause of the problem. You also did not answer my questions about the database schema.

  • Any weirdness with realtime has almost always gone back to schema issue for me. Just my experience…

    > Joshua
    >
    > We have completed more testing this morning and when we remove the
    > realtime cache options from the sorcery file the endpoints complete
    > registration, but we pjsip show/list does not offer any feed back at all,
    > We also can’t send any pjsip send notify commands as they say they don’t
    > have an endpoint there. Something has changed in the cache part of the
    > system that is breaking the system in some manner for us with the current
    > version and we are out of ideas.

    You’re still confusing me here. If you’ve removed the cache, then it’s
    not being used anymore so I don’t see how it can be a problem. If the
    commands aren’t listing things when you have no cache even in use then
    that would point to realtime, not the cache. You’d need to do as I said
    with debug to see what queries are being done to confirm things. You
    need to do troubleshooting and isolate things to determine the cause of
    the problem. You also did not answer my questions about the database
    schema.

  • Joshua

    We are using MariaDB as the database storage. We have recreated the database tables with alembic.

    Test 1:
    We enable tables for aors, auths and endpoints only. With cache turned off the end point registers successfully We have no way to get any feed back as pjsip show/list returns no objects found. pjsip send notify cmd endpoint — does not work as it says there is no endpoint. endpoint can send a call as it appears to be registered, we have no way to confirm this form the console but calls come in.

    Test 2:
    We enable cache on the endpoints, auth and aors in the sorcery.conf
    endpoint/cache memory_cache,object_lifetime_stale`0,object_lifetime_maximum00,expire_o n_reload=yes,full_backend_cache=yes
    auth/cache=memory_cache,expire_on_reload=yes aor/cache memory_cache,object_lifetime_stale00,object_lifetime_maximum00,expire_
    on_reload=yes,full_backend_cache=yes
    We now get an error: [2017-09-15 11:02:04] WARNING[3375]:
    res_pjsip_registrar.c:744 registrar_on_rx_request: AOR ‘6162480909-300’ has no configured max_contacts. Endpoint ‘6162480909-300’ unable to register
    The aors entry has the max_contacts set to 1 but the error still occurs.

    pjsip show/list shows the endpoint shows endpoints, aors, auths but registration fails

    Test 3:
    We enable cache on the endpoints, auth and aors in the sorcery.conf
    endpoint/cache memory_cache,object_lifetime_stale`0,object_lifetime_maximum00,expire_o n_reload=yes auth/cache=memory_cache,expire_on_reload=yes aor/cache memory_cache,object_lifetime_stale00,object_lifetime_maximum00,expire_
    on_reload=yes
    Endpoint registers pjsip show/list endpoints works the first time and fails there after. UBNTU-ROSSI-GUEST*CLI> pjsip show endpoints
    Endpoint:

    I/OAuth:

    Aor:

    Contact:

    Transport:

    Identify:

    Match:
    Channel:

    Objects found: 1
    UBNTU-ROSSI-GUEST*CLI> pjsip show endpoints No objects found.

    pjsip show/list shows the endpoint fails ever time after the first.

    Test 4:
    Test 1: with the addition of the contacts entry as realtime in sorcery.conf We get error on registration attempt: [2017-09-15
    11:16:07] WARNING[3591]: res_config_odbc.c:120 custom_prepare: SQL Prepare failed! [INSERT IGNORE INTO ps_contacts (id, via_addr, qualify_timeout, call_id, reg_server, path, endpoint, via_port, authenticate_qualify, uri, qualify_frequency, user_agent, expiration_time, outbound_proxy) VALUES (?,
    ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] [2017-09-15 11:16:07]
    ERROR[3591]: res_pjsip_registrar.c:432 register_aor_core: Unable to bind contact ‘sip:6162480909-300@192.168.201.105:59758’ to AOR ‘6162480909-300’

    Registration has failed at this point.

    I can offer the following:
    A dump of the database schema that alembic is creating.
    extconfig.config
    sorcery.conf

    Thanks Bryant

    ————————————–

  • The show and list commands are supposed to work, even without caching being enabled. Your problem is therefore at the realtime level. Calls coming in should appear on the console, and the endpoint name will be in the channel name. Enabling caching just masks it some because things exist in the cache for a bit.

    Feel free to provide these and me (or another individual) may pick out what is wrong.

  • Hello.

    Did you ps_contacts table has all columns listed here?

    INSERT IGNORE INTO ps_contacts (id, via_addr, qualify_timeout, call_id, reg_server, path, endpoint, via_port, authenticate_qualify, uri, qualify_frequency, user_agent, expiration_time, outbound_proxy) VALUES
    (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

    Regards, Marcelo H. Terres
    IM: mhterres@jabber.mundoopensource.com.br https://www.mundoopensource.com.br https://twitter.com/mhterres https://linkedin.com/in/marceloterres