Hello All,
Problem: My main issue is that when I "REGISTER" a client via Kamailio, and I attempt to "Dial" a different endpoint within an Asterisk Dial Plan, Asterisk throws an error stating that the endpoint (the number I am dialing via "Dial") is not registered or reachable. However, commands like "Playback" do work correctly for the client I "REGISTERED" via Kamailio. E.g. I register client 10001 in Kamailio, I then register another client 10002 in Kamalio; both 10001 and 10002 can exercise an Asterisk Dial Plan which will play videos/audio (No Problem). But, now I want 10001 to Call (Dial) 10002; it is at this point that Asterisk throws the error "10002 is not registered or reachable".
I have tried many of the suggestion on many different help boards (several times) but I am still unable to forward a registration from Kamailio to Asterisk.
With my current Kamailio configuration (I do use dispatching), I see , via tcpdump, Asterisk receiving a "REGISTER" request, and Asterisk sends back the "unauthorized" as expected, however, Kamailio does not re-send the "REGISTER" as is customary. I am not sure of the next step to take, but I feel I have a couple of options.
* I can continue to try and figure out why Kamailio is not sending the second "REGISTER" (I have not yet been able to figure this out). * Tell Asterisk to not require authentication. (I am using pjsip and do not know how to not require authentication in Asterisk when the request is from Kamailio).
I have put a lot of time into this one, and I am at a sticking point. Any help or suggestions would be very much appreciated.
Thank you,
You could also just use the Kamailio address in your Dial command...
Dial(SIP/user@kamailio)
This will be beneficial if you will be running multiple asterisk servers using a base registered on Kamailio.
Of course, there's many ways to go about this...
--fred
Hello and thank you for the reply.
I did try something like this before with no luck => Dial(PJSIP/20001@129.4.1.32) where 129.4.1.32 is the IP Address of Kamailio. When I attempt this, I get the error => Endpoint '20001': Could not create dialog to invalid URI '20001'. Is endpoint registered and reachable? And 20001 is registered in 129.4.1.32.
Thank you,
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of Fred Posner Sent: Wednesday, December 6, 2017 2:09 PM To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] Forwarding Registration to Asterisk
You could also just use the Kamailio address in your Dial command...
Dial(SIP/user@kamailio)
This will be beneficial if you will be running multiple asterisk servers using a base registered on Kamailio.
Of course, there's many ways to go about this...
--fred
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Wed, Dec 6, 2017 at 2:16 PM, Wilkins, Steve swwilkins@mitre.org wrote:
Hello and thank you for the reply.
I did try something like this before with no luck => Dial(PJSIP/ 20001@129.4.1.32) where 129.4.1.32 is the IP Address of Kamailio. When I attempt this, I get the error => Endpoint '20001': Could not create dialog to invalid URI '20001'. Is endpoint registered and reachable? And 20001 is registered in 129.4.1.32.
Thank you,
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of Fred Posner Sent: Wednesday, December 6, 2017 2:09 PM To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] Forwarding Registration to Asterisk
You could also just use the Kamailio address in your Dial command...
Dial(SIP/user@kamailio)
This will be beneficial if you will be running multiple asterisk servers using a base registered on Kamailio.
Of course, there's many ways to go about this...
As Fred said, there's a lot of ways you can approach this, all of which have trade-offs. You can go pretty deep in depth with any one of these approaches, so I'll just allude to some of your options.
It's good to keep in mind that there are three ways you can map an inbound request to an endpoint:
1) By From username. This matches to an AoR, which is associated to an endpoint 2) By IP address/DNS hostname, using an identify section associated to an endpoint 3) By header, which also uses an identify section
When using registration, this will create a Contact that is associated to an AoR. That AoR can be associated to an Endpoint. When dialing, Asterisk will look up the Contacts on the AoR that is associated to an Endpoint and send INVITE requests to all of those Contacts.
You can, of course, simply set up a static Contact for your Kamailio proxy (represented with an Endpoint/AoR0 and let it handle all of the subsequent routing decisions. But that gets into some various options you have.
Thus, some options:
1. Proxy REGISTER requests through to Asterisk, allowing Asterisk to (believe) it is the Registrar
In this particular case, you'll need a PJSIP endpoint for each SIP endpoint that is registering. Identification will need to be done based either on the From user or by a custom header that Kamailio can add and pass off to Asterisk. You will need to use the outbound_proxy options so that outbound requests go through Kamailio as opposed to directly to the registered endpoints. The benefit of this is that it gives Asterisk all of the information it needs, all of the time. The downside is that you now have potentially many services acting as a Registrar, and you have a lot of traffic flying around that you don't need or want.
2. Create an endpoint in Asterisk that represents your pool of Proxies
In this case, you would have Kamailio act as the Registrar. If it determines that it needs Asterisk, it would route the INVITE request down to Asterisk. Asterisk would match based on IP address or Header, and would have a single endpoint representing inbound requests from the pool of proxies. You could re-use this same endpoint for outbound requests, or have several different outbound endpoints with different codec capabilities (if needed), typically matching different phone profiles. You would most likely want a static contact set to the DNS name of your proxies, and Dial using SIP URI over that endpoint. The upside of this is that it keeps Asterisk simple and ignorant of all of the phones/registrations; the downside is that BLF handling and call state becomes problematic (as you don't have endpoints to match them to any longer!)
3. Create endpoints for all of the phones, but have them all have a Contact that is Kamailio
This combines both #1 and #2, giving you the best (and maybe the worst) of both worlds. You will need an AoR with a static contact that maps to the Kamailio proxies, so that all outbound requests flow through them. Inbound requests can be matched either by From user or by a custom Header, depending on how much flexibility you need. Because you have endpoints for all your phones still, your extension state/device state handling will work better. Handling subscriptions can be done either at Kamailio or at Asterisk, so long as Asterisk is configured to PUBLISH state information to the Kamailio proxies.
Note that there are many more options. PJSIP in Asterisk is a toolkit, and there isn't a right way to do this - merely ways that balance different system needs. For what it's worth, depending on the inbound traffic, I've used both #2 and #3. I tend to shy away from #1, as I like to keep each service having a specific purpose, and Kamailio acts as a good registrar in a larger system.
Matt
Matt,
On Wed, Dec 06, 2017 at 04:10:21PM -0600, Matthew Jordan wrote:
- Proxy REGISTER requests through to Asterisk, allowing Asterisk to
(believe) it is the Registrar
In this particular case, you'll need a PJSIP endpoint for each SIP endpoint that is registering. Identification will need to be done based either on the From user or by a custom header that Kamailio can add and pass off to Asterisk. You will need to use the outbound_proxy options so that outbound requests go through Kamailio as opposed to directly to the registered endpoints. The benefit of this is that it gives Asterisk all of the information it needs, all of the time. The downside is that you now have potentially many services acting as a Registrar, and you have a lot of traffic flying around that you don't need or want.
Can't a lot of the complications here be obviated through Path?
Hello Matt,
I have attempted an outbound_proxy, but when I do this I get the following response from Asterisk -
[Dec 6 23:42:51] VERBOSE[14500][C-00000001] pbx.c: Executing [20001@from-internal:5] Dial("PJSIP/kamailio-00000000", "PJSIP/20001,30,t") in new stack [Dec 6 23:42:51] VERBOSE[14500][C-00000001] app_dial.c: Called PJSIP/20001 [Dec 6 23:42:51] VERBOSE[14363] res_rtp_asterisk.c: DTLS ECDH initialized (automatic), faster PFS enabled [Dec 6 23:42:51] VERBOSE[14363] res_rtp_asterisk.c: DTLS ECDH initialized (automatic), faster PFS enabled [Dec 6 23:42:51] VERBOSE[14500][C-00000001] app_dial.c: Everyone is busy/congested at this time (1:0/0/1) [Dec 6 23:42:51] VERBOSE[14500][C-00000001] pbx.c: Executing [20001@from-internal:6] Hangup("PJSIP/kamailio-00000000", "") in new stack
I did verify that 20001 is registered and that I have the correct Kamailio Server IP in my outbound_proxy.
Thank you, -Steve
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of Alex Balashov Sent: Wednesday, December 6, 2017 6:33 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Forwarding Registration to Asterisk
Matt,
On Wed, Dec 06, 2017 at 04:10:21PM -0600, Matthew Jordan wrote:
- Proxy REGISTER requests through to Asterisk, allowing Asterisk to
(believe) it is the Registrar
In this particular case, you'll need a PJSIP endpoint for each SIP endpoint that is registering. Identification will need to be done based either on the From user or by a custom header that Kamailio can add and pass off to Asterisk. You will need to use the outbound_proxy options so that outbound requests go through Kamailio as opposed to directly to the registered endpoints. The benefit of this is that it gives Asterisk all of the information it needs, all of the time. The downside is that you now have potentially many services acting as a Registrar, and you have a lot of traffic flying around that you don't need or want.
Can't a lot of the complications here be obviated through Path?
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On 12/6/17 6:48 PM, Wilkins, Steve wrote:
Hello Matt,
I have attempted an outbound_proxy, but when I do this I get the following response from Asterisk -
[Dec 6 23:42:51] VERBOSE[14500][C-00000001] pbx.c: Executing [20001@from-internal:5] Dial("PJSIP/kamailio-00000000", "PJSIP/20001,30,t") in new stack [Dec 6 23:42:51] VERBOSE[14500][C-00000001] app_dial.c: Called PJSIP/20001 [Dec 6 23:42:51] VERBOSE[14363] res_rtp_asterisk.c: DTLS ECDH initialized (automatic), faster PFS enabled [Dec 6 23:42:51] VERBOSE[14363] res_rtp_asterisk.c: DTLS ECDH initialized (automatic), faster PFS enabled [Dec 6 23:42:51] VERBOSE[14500][C-00000001] app_dial.c: Everyone is busy/congested at this time (1:0/0/1) [Dec 6 23:42:51] VERBOSE[14500][C-00000001] pbx.c: Executing [20001@from-internal:6] Hangup("PJSIP/kamailio-00000000", "") in new stack
I did verify that 20001 is registered and that I have the correct Kamailio Server IP in my outbound_proxy.
Thank you, -Steve
With this list, probably best to through a SIP capture from the Asterisk and from the Kamailio to see where 4xx is coming from.
--fred
On Wed, Dec 6, 2017 at 5:48 PM, Wilkins, Steve swwilkins@mitre.org wrote:
Hello Matt,
I have attempted an outbound_proxy, but when I do this I get the following response from Asterisk -
[Dec 6 23:42:51] VERBOSE[14500][C-00000001] pbx.c: Executing [20001@from-internal:5] Dial("PJSIP/kamailio-00000000", "PJSIP/20001,30,t") in new stack [Dec 6 23:42:51] VERBOSE[14500][C-00000001] app_dial.c: Called PJSIP/20001 [Dec 6 23:42:51] VERBOSE[14363] res_rtp_asterisk.c: DTLS ECDH initialized (automatic), faster PFS enabled [Dec 6 23:42:51] VERBOSE[14363] res_rtp_asterisk.c: DTLS ECDH initialized (automatic), faster PFS enabled [Dec 6 23:42:51] VERBOSE[14500][C-00000001] app_dial.c: Everyone is busy/congested at this time (1:0/0/1) [Dec 6 23:42:51] VERBOSE[14500][C-00000001] pbx.c: Executing [20001@from-internal:6] Hangup("PJSIP/kamailio-00000000", "") in new stack
I did verify that 20001 is registered and that I have the correct Kamailio Server IP in my outbound_proxy.
Thank you, -Steve
You'll need to show the SIP traffic for this - preferably from both Asterisk and Kamailio. The problem could be in either location (or neither, even).
It appears the bottom line is that when using Kamailio, Asterisk does not register the endpoints. Therefore, everything works as long as I am not trying to connect one Kamailio endpoint to another Kamailio endpoint that both use Asterisk. So in my example, I have two web clients that can both call asterisk tasks like “Playback”, but, cannot contact each other because Kamailio is not forwarding registration information to Asterisk and Asterisk is unable to get back to the Kamailio registrations to find each other’s endpoints.
I still believe this boils down to
* An issue with Kamailio not properly forwarding registrations to Asterisk (could be me, but I do try to forward the registration in kamailio.cfg)
Note: in tcpdump I do see the “REGISTER” being sent to Asterisk and Asterisk sends back the unauthorized (as expected) but Kamailio does not send a second “REGISTER”.
(I believe that if I could tell Asterisk to not require authentication, then the endpoint would then be registered on Asterisk also)
I honestly don’t know if this is a Kamailio or an Asterisk issue.
P.S. I have tried all suggestion on this and other boards but to no avail. Asterisk is just no seeing all endpoints that Kamailio does.
Thank you
From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of Matthew Jordan Sent: Thursday, December 7, 2017 8:51 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Forwarding Registration to Asterisk
On Wed, Dec 6, 2017 at 5:48 PM, Wilkins, Steve <swwilkins@mitre.orgmailto:swwilkins@mitre.org> wrote: Hello Matt,
I have attempted an outbound_proxy, but when I do this I get the following response from Asterisk -
[Dec 6 23:42:51] VERBOSE[14500][C-00000001] pbx.c: Executing [20001@from-internal:5] Dial("PJSIP/kamailio-00000000", "PJSIP/20001,30,t") in new stack [Dec 6 23:42:51] VERBOSE[14500][C-00000001] app_dial.c: Called PJSIP/20001 [Dec 6 23:42:51] VERBOSE[14363] res_rtp_asterisk.c: DTLS ECDH initialized (automatic), faster PFS enabled [Dec 6 23:42:51] VERBOSE[14363] res_rtp_asterisk.c: DTLS ECDH initialized (automatic), faster PFS enabled [Dec 6 23:42:51] VERBOSE[14500][C-00000001] app_dial.c: Everyone is busy/congested at this time (1:0/0/1) [Dec 6 23:42:51] VERBOSE[14500][C-00000001] pbx.c: Executing [20001@from-internal:6] Hangup("PJSIP/kamailio-00000000", "") in new stack
I did verify that 20001 is registered and that I have the correct Kamailio Server IP in my outbound_proxy.
Thank you, -Steve
You'll need to show the SIP traffic for this - preferably from both Asterisk and Kamailio. The problem could be in either location (or neither, even).
On 12/7/17 12:10 PM, Wilkins, Steve wrote:
It appears the bottom line is that when using Kamailio, Asterisk does not register the endpoints.
As an FYI, Asterisk does not need endpoints to be registered. Devil's in the details here so it really depends on what exactly you're doing and how you're doing it.
[SNIP] Note: in tcpdump I do see the “REGISTER” being sent to Asterisk and Asterisk sends back the unauthorized (as expected) but Kamailio does not send a second “REGISTER”. [SNIP]
A really think a packet capture covering endpoint, kamailio, and asterisk will help shine some light...
This being said, if you're having Asterisk handle the registration, how are you forwarding this in Kamailio?
--fred
Hi ALL,
I have taken tcpdumps and I see Kamailio sending an "INVITE" to Asterisk and Asterisk responds with "OK" three times and that is the end of SIP traffic. But Asterisk throws the error => "Endpoint '20001': Could not create dialog to invalid URI '20001'". I verified that endpoint 20001 is indeed not registered in Asterisk, so Asterisk does not know what endpoint to send data to. But the endpoint is registered in Kamailio, so I thought if I forwarded the registration from Kamailio to Asterisk, then Asterisk would have access to that endpoint.
I am relatively new to Asterisk and Kamailio and I am not sure why this is not working. As I have mentioned, I have WebRTC client1 and WebRTC client2 both being able to send requests through Kamailio to Asterisk and back to the clients successfully (as long as I am only doing things like having asterisk play video/audio) However, client1 cannot see client2 because Asterisk does not have any registration information on client1 or client2.
=> It appears the bottom line is that when using Kamailio, Asterisk does not register the endpoints. Therefore, everything works as long as I am not trying to connect one Kamailio endpoint to another Kamailio endpoint that both use Asterisk. So in my example, I have two web clients that can both call asterisk tasks like “Playback”, but, cannot contact each other because Kamailio is not forwarding registration information to Asterisk and Asterisk is unable to get back to the Kamailio registrations to find each other’s endpoints.
I still believe this boils down to - An issue with Kamailio not properly forwarding registrations to Asterisk (could be me, but I do try to forward the registration in kamailio.cfg) Note: in tcpdump I do see the “REGISTER” being sent to Asterisk and Asterisk sends back the unauthorized (as expected) but Kamailio does not send a second “REGISTER”. (I believe that if I could tell Asterisk to not require authentication, then the endpoint would then be registered on Asterisk also)
I honestly don’t know if this is a Kamailio or an Asterisk issue.
P.S. I have tried all suggestion on this and other boards but to no avail. Asterisk is just no seeing all endpoints that Kamailio does.
Thank you
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of Fred Posner Sent: Thursday, December 7, 2017 12:17 PM To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] Forwarding Registration to Asterisk
On 12/7/17 12:10 PM, Wilkins, Steve wrote:
It appears the bottom line is that when using Kamailio, Asterisk does not register the endpoints.
As an FYI, Asterisk does not need endpoints to be registered. Devil's in the details here so it really depends on what exactly you're doing and how you're doing it.
[SNIP] Note: in tcpdump I do see the “REGISTER” being sent to Asterisk and Asterisk sends back the unauthorized (as expected) but Kamailio does not send a second “REGISTER”. [SNIP]
A really think a packet capture covering endpoint, kamailio, and asterisk will help shine some light...
This being said, if you're having Asterisk handle the registration, how are you forwarding this in Kamailio?
--fred
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Wed, Dec 6, 2017 at 5:32 PM, Alex Balashov abalashov@evaristesys.com wrote:
Matt,
On Wed, Dec 06, 2017 at 04:10:21PM -0600, Matthew Jordan wrote:
- Proxy REGISTER requests through to Asterisk, allowing Asterisk to
(believe) it is the Registrar
In this particular case, you'll need a PJSIP endpoint for each SIP
endpoint
that is registering. Identification will need to be done based either on the From user or by a custom header that Kamailio can add and pass off to Asterisk. You will need to use the outbound_proxy options so that
outbound
requests go through Kamailio as opposed to directly to the registered endpoints. The benefit of this is that it gives Asterisk all of the information it needs, all of the time. The downside is that you now have potentially many services acting as a Registrar, and you have a lot of traffic flying around that you don't need or want.
Can't a lot of the complications here be obviated through Path?
Maybe? I'm not sure - how would Path (which Asterisk supports as well) remove the need to proxy the REGISTER request to all of the Asterisk instances?
Hello, I saw next emails but prefer answer directly here. Comments inline.
Regards,
Ivo
On 12/06/2017 08:33 PM, Wilkins, Steve wrote:
Hello All,
*Problem*: My main issue is that when I “REGISTER” a client via Kamailio, and I attempt to “Dial” a different endpoint within an Asterisk Dial Plan, Asterisk throws an error stating that the endpoint (the number I am dialing via “Dial”) is not registered or reachable. However, commands like “Playback” do work correctly for the client I “REGISTERED” via Kamailio.
E.g. I register client 10001 in Kamailio, I then register another client 10002 in Kamalio; both 10001 and 10002 can exercise an Asterisk Dial Plan which will play videos/audio (No Problem). But, now I want 10001 to Call (Dial) 10002; it is at this point that Asterisk throws the error “10002 is not registered or reachable”.
I have tried many of the suggestion on many different help boards (several times) but I am still unable to forward a registration from Kamailio to Asterisk.
So if your statement below is true your problems are replies not request ?
With my current Kamailio configuration (I do use dispatching), I see , via tcpdump, Asterisk receiving a “REGISTER” request, and Asterisk sends back the “unauthorized” as expected, however, Kamailio does not re-send the “REGISTER” as is customary. I am not sure of the next step to take, but I feel I have a couple of options.
At this point you can treat REGISTER as any other request in term of Kamailio configuration. So you dispatch it, request leaves Kamailio but reply is not forwarded to the endpoint. Most probably you do not have on_reply route handling register replies from Asterisk. On 200 OK you can save() location before forwarding register reply to SIP endpoint. - Note 1. Requested architecture/feature is targeted more to SBC but not to a SIP proxy. At that point Kamailio is upstream registrar and Asterisk is registrar and subscriber DB. - Note 2. This can be made w/ Kamailio but more than just forwarding requests need to be made. There are other cases (transport, nat, conatct ...) that need to be addressed.
I think it is well described here : http://www.frafos.com/uploa/html/29__Registration_Caching_and_Handling.html?...
- I can continue to try and figure out why Kamailio is not sending the second “REGISTER” (*I have not yet been able to figure this out*).
- Tell Asterisk to not require authentication. (*I am using pjsip and do not know how to not require authentication in Asterisk when the request is from Kamailio*).
This is more common approach, Integrate Kamailio and Asterisk via DB and use Kamailio as registrar.
I have put a lot of time into this one, and I am at a sticking point. Any help or suggestions would be very much appreciated.
Thank you,
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users