Asterisk pjsip - contact uri or hostname length exceeds pjproject limit

I am using Asterisk 13.13 and getting error (crashing) while using the below dial string

exten => _X.,n,Dial(${PJSIP_DIAL_CONTACTS(${ENDPOINT})},40,g)

-----ERROR----
Executing [1234567890@PEER-ALL:11] Dial(“PJSIP/mytrunk_IN-00000029”, “PJSIP/1234567890@101”) in new stack
== Begin MixMonitor Recording PJSIP/mytrunk_IN-00000029
[Dec 19 09:32:44] ERROR[23108]: res_pjsip/location.c:535 permanent_uri_handler: Contact uri or hostname length exceeds pjproject limit: 101
[Dec 19 09:32:44] ERROR[23108]: config_options.c:738 aco_process_var: Error parsing contact=101 at line 0 of
[Dec 19 09:32:44] ERROR[23108]: res_pjsip.c:2912 ast_sip_create_dialog_uac: Endpoint ‘101’: Could not create dialog to invalid URI ‘101’. Is endpoint registered?
[Dec 19 09:32:44] ERROR[23108]: chan_pjsip.c:2100 request: Failed to create outgoing session to endpoint ‘101’
[Dec 19 09:32:44] WARNING[23124][C-00000017]: app_dial.c:2525 dial_exec_full: Unable to create channel of type ‘PJSIP’ (cause 3 - No route to destination)

I’d suggest updating to the latest version of 13 and also ensuring you are using the bundled version of PJSIP. We set the maximum to 512 in ours.

Ok, I will update to 13.18.

So you mean can we set the limit while upgrading or do we need to change the core file and then compile and what is the default limit of a dial string?

If using bundled PJSIP Asterisk will build PJSIP with a URI limit of 512 automatically. I don’t know off the top of my head what the limit is for a dial string, but it’s certainly longer than 512.

1 Like

Hi @jcolp

I have upgraded Asterisk to 13.18.4 and now the error coming slightly different

Contact uri or hostname length exceeds pjproject limit or is not a sip(s) uri: 101

In Ast 13.13 it was

Contact uri or hostname length exceeds pjproject limit: 101

Is it normal now?

@jcolp Sorry, It was my mistake…I have mentioned the endpoint in contact field instead of URI… It is working now

But new error after upgrading when somebody is trying to register ast box 13.18.4 is throwing warning

res_config_odbc.c:120 custom_prepare: SQL Prepare failed! [INSERT INTO ps_contacts (id, via_addr, qualify_timeout, call_id, reg_server, prune_on_boot, path, endpoint, via_port, authenticate_qualify, uri, qualify_frequency, user_agent, expiration_time, outbound_proxy) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]

And I have seen in the contacts table some fields name are different than this, so is it safe to change the field name in the table and wont effect other things?

The schema changes between versions, we include the SQL files and you can also use alembic to automatically upgrade them.

1 Like

Oh Ok, Thanks so much @jcolp

Just for your information still prune_on_boot field missing in those sql files so I have done the alter in my query to add that field but i do not know the functionality of that

So I guess others are also facing the same issue so please update that sql schema.

According to the issue tracker[1] there was a bug in the alembic for that option which was fixed, so it is there in some form. If it’s not working for you then you’ll need to file a new bug with details[2].

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