Troubles with SIP provider using realtime: what I miss?

This is my sql part of pjsip configuration

--tim-uscita
insert into ps_aors (id, contact, max_contacts, qualify_frequency, outbound_proxy) values ('tim-uscita', 'sip:+MYNUMBER@telecomitalia.it:5060', 1, 60, 'PROXYIPCORRECT');
insert into ps_registrations (id, retry_interval, max_retries, expiration, transport, outbound_auth, client_uri, server_uri ) values ('tim-uscita', 20, 10, 120, 'transport-udp', 'tim-uscita', 'sip:+MYNUMBER@telecomitalia.it:5060', 'sip:PROXYIPTCORRECT:5060');
insert into ps_auths (id, auth_type, password, username) values ('tim-uscita', 'userpass', 'MYPASS', '+MYNUMBER');
insert into ps_endpoints (id, context, disallow, allow, outbound_proxy, inband_progress, from_user, from_domain, tone_zone, language, auth, outbound_auth, aors) values ('tim-uscita', 'uscita', 'all', 'ulaw,alaw,gsm,speex,opus,ilbc', 'sip:PROXYIPCORRECT:5060', 'yes', '+MYNUMBER', 'telecomitalia.it', 'it', 'it', 'tim-uscita', 'tim-uscita', 'tim-uscita');

--tim-entrata
insert into ps_aors (id, contact, max_contacts, qualify_frequency, outbound_proxy) values ('tim-entrata', 'sip:+MYNUMBER@telecomitalia.it:5060', 1, 60, 'PROXYIPCORRECT');
insert into ps_auths (id, auth_type, password, username) values ('tim-entrata', 'userpass', 'MYPASS', '+MYNUMBER');
insert into ps_endpoints (id, context, disallow, allow, rtp_symmetric, force_rport, rewrite_contact, inband_progress, tone_zone, language, auth, outbound_auth, aors) values ('tim-entrata', 'entrata', 'all', 'ulaw,alaw,gsm,speex,opus,ilbc', 'yes', 'yes', 'yes', 'yes', 'it', 'it', 'tim-entrata', 'tim-entrata', 'tim-entrata');

I restart asterisk, and provider seems to register correctly

tim-uscita/sip:PROXYIP:5060 tim-uscita Registered (exp. 233s)

In extensions.conf I use this

; Tim uscita
[uscita]
exten => _XXXXX.,1,NoOp()
same => n,Set(CALLERID(number)=mynumber)
same => n,Dial(PJSIP/tim-uscita/${EXTEN},30,tTkK)
same => n,Hangup()

; Tim entrata
[entrata]
exten = +mynumber,1,NoOp()
same => n,GoTo(local,1001,1)
same  => n,Playtones(congestion)
same = n,Hangup()

I made a call and…

 == Setting global variable 'PHONEEXTNUMBER' to 'MYUMBER'
[Jan 21 12:39:53] ERROR[5131]: res_pjsip/pjsip_options.c:887 sip_options_qualify_contact: Unable to apply outbound proxy on request to qualify contact sip:+MYNYMBER@telecomitalia.it:5060
[Jan 21 12:39:58] ERROR[5131]: res_pjsip.c:993 ast_sip_create_dialog_uac: Endpoint 'tim-uscita': Could not create dialog to invalid URI '123456'.  Is endpoint registered and reachable?
[Jan 21 12:39:58] ERROR[5131]: chan_pjsip.c:2702 request: Failed to create outgoing session to endpoint 'tim-uscita'
[Jan 21 12:39:58] NOTICE[5568][C-00000004]: app_dial.c:2705 dial_exec_full: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)

the number 123456 is the number that I call (of course is fake, the real number is hidden for privacy reason)
What I miss?

An outbound proxy is a SIP URI, not an IP address.

Additionally this:

Is incorrect. It should be:

PJSIP/${EXTEN}@tim-uscita

This works fine, but call still fall with message

Unable to apply outbound proxy on request to qualify contact...

I have copied the string (of course adapted with my number) from here

If you truly need an outbound proxy, it would likely be this in realtime:

sip:<address>^3Blr

I put those lines now

insert into ps_aors (id, contact, max_contacts, qualify_frequency, outbound_proxy) values ('tim-uscita', 'sip:+MYNUMBER@telecomitalia.it:5060', 1, 60, 'sip:1.3.4.5:5060^3Blr');
insert into ps_aors (id, contact, max_contacts, qualify_frequency, outbound_proxy) values ('tim-entrata', 'sip:+MYNUMBER@telecomitalia.it:5060', 1, 60, insert into ps_aors (id, contact, max_contacts, qualify_frequency, outbound_proxy) values ('tim-uscita', 'sip:+MYNUMBER@telecomitalia.it:5060', 1, 60, 'sip:1.3.4.5:5060^3Blr');

but still no calls with the error ā€œUnable to apply outbound proxy on request to qualify contactā€¦ā€

And what does ā€œpjsip show aor tim-uscitaā€ show?

I would also add that trying the .conf file first to verify configuration is generally a good approach, as realtime adds additional complexity.

Also, you have the outbound proxy set on the endpoint too. If you haven’t updated that as well, then that would be a problem.

It said


 ParameterName        : ParameterValue
 =============================================================
 authenticate_qualify : false
 contact              : sip:+mynumber@telecomitalia.it:5060
 default_expiration   : 3600
 mailboxes            :
 max_contacts         : 1
 maximum_expiration   : 7200
 minimum_expiration   : 60
 outbound_proxy       : sip:ipofproxy:5060;lr
 qualify_frequency    : 60
 qualify_timeout      : 3.000000
 remove_existing      : false
 remove_unavailable   : false
 support_path         : false
 voicemail_extension  :

meanwhile I solved the error of proxy adding the voice ā€œoutbound_proxyā€ in ps_registrations
but the call still fail

Did you update the outbound_proxy on the endpoint?

Was that the error, thanks for help. I have fix the outbound proxy line everywhere except on endpoint
Next minute I post the configuration, maybe help for other users.

now the problem are call in arrive

: Request 'INVITE' from '<sip:+thenumberoforigin@telecomitalia.it;user=phone>' failed for ''ipofproxy:5060" (callid: p65541t1737464179m292164c127798s2) - No matching endpoint found

Asterisk has to match incoming calls to an endpoint. You haven’t configured anything to do so. One option is ā€œlineā€ on the outbound registration which MAY work (it is dependent on the upstream), or configuring an identify to match based on IP address.

Thanks I will try now. Just a stupid question: i have to specify the ā€œoutbound proxyā€ also for ā€œtim-entrataā€?

That’s a provider question I have no insight into.

Now I’m using this sql configuration

--tim-uscita
insert into ps_aors (id, contact, max_contacts, qualify_frequency, outbound_proxy) values ('tim-uscita', 'sip:+mynumber@telecomitalia.it:5060', 1, 60, 'sip:ipofproxy:5060^3Blr');
insert into ps_registrations (id, retry_interval, max_retries, expiration, transport, outbound_auth, client_uri, server_uri, outbound_proxy) values ('tim-uscita', 20, 10, 120, 'transport-udp', 'tim-uscita', 'sip:mynumber@telecomitalia.it:5060', 'sip:telecomitalia.it:5060', 'sip:ipofproxy:5060^3Blr');
insert into ps_auths (id, auth_type, password, username) values ('tim-uscita', 'userpass', 'mypass', 'mynumber');
insert into ps_endpoints (id, context, disallow, allow, inband_progress, from_user, from_domain, tone_zone, language, auth, outbound_auth, aors, outbound_proxy) values ('tim-uscita', 'uscita', 'all', 'ulaw,alaw,gsm,speex,opus,ilbc', 'yes', 'mynnumber', 'telecomitalia.it', 'it', 'it', 'tim-uscita', 'tim-uscita', 'tim-uscita', 'sip:ipofproxy:5060^3Blr');
insert into ps_endpoint_id_ips(id,endpoint,`match`) values ('tim-uscita','tim-uscita','telecomitalia.it');

--tim-entrata
insert into ps_aors (id, contact, max_contacts, qualify_frequency, outbound_proxy) values ('tim-entrata', 'sip:mynumber@telecomitalia.it:5060', 1, 60, 'sip:ipofproxy:5060^3Blr');
insert into ps_auths (id, auth_type, password, username) values ('tim-entrata', 'userpass', 'mypasswowrd', 'mynmber');
insert into ps_endpoints (id, context, disallow, allow, rtp_symmetric, force_rport, rewrite_contact, inband_progress, tone_zone, language, auth, outbound_auth, aors) values ('tim-entrata', 'entrata', 'all', 'ulaw,alaw,gsm,speex,opus,ilbc', 'yes', 'yes', 'yes', 'yes', 'it', 'it', 'tim-entrata', 'tim-entrata', 'tim-entrata');
insert into ps_endpoint_id_ips(id,endpoint,`match`) values ('tim-entrata','tim-entrata','telecomitalia.it');

I can call without problems, but not receive.

The error is same

"[Jan 21 15:09:11] NOTICE[8461]: res_pjsip/pjsip_distributor.c:673 log_failed_request: Request 'INVITE' from '<sip:+39numbercalltomyhome@telecomitalia.it;user=phone>' failed for 'ipofproxy:5060' (callid: p65541t1737468551m1760c30356s2) - No matching endpoint found

+1

Whilst I’ve never used ARA myself, I think that, if I did use it, I would only use it for telephones, not providers, or anything else that was low volume, but potentially difficult to configure.

Having this in a database means it is difficult to make it easily readable to other people, as you end up with large numbers of default settings, to act as noise.

This is my configuration for extensions.conf

; Tim entrata

[entrata]
exten = +12345,1,NoOp()
;same => n,GoTo(local/1001 && from-dahdi/4002,1,20,t,m)
same => n,GoTo(local/1001 && from-dahdi/4002,1,20,t,m)
same => n,Playtones(congestion)
same = n,Hangup()

I try now with the old good pjsip.conf

This doesn’t make sense.