Then you have to use the first function I told you from the module registrar. If you look at the example from the docs
you can use the case 1 “contacts found and returned” to create a switch and relay your sip messages when is case 1
Something like this
lookup("location");
switch ($retcode) {
case 1: t_relay();
case -3:
sl_send_reply("404", "Not Found");
exit;
case -2:
sl_send_reply("405", "Not Found");
exit;
};
Samuel Moya Tinoco Departamento de Sistemas y Redes
Móvil: (+34) 606985997 |
|
Soluciones inteligentes
|
|
De: o.atef@fiberme.com
<o.atef@fiberme.com>
Enviado el: martes, 2 de abril de 2024 12:51
Para: SAMUEL MOYA TINOCO <smoya@vivelibre.es>; 'Kamailio (SER) - Users Mailing List' <sr-users@lists.kamailio.org>
Asunto: RE: [SR-Users] How to relay SIP messages to specific registered user in Kamailio?
Well, with function I gonna replace the TO header, but all what I need is just relay SIP messages
throw the user “test” as a trunk without modifying the TO header.
Sorry for bothering you I’m still beginner in Kamailio.
From:
SAMUEL MOYA TINOCO <smoya@vivelibre.es>
Sent: Tuesday, April 2, 2024 12:45 PM
To: o.atef@fiberme.com;
'Kamailio (SER) - Users Mailing List' <sr-users@lists.kamailio.org>
Subject: RE: [SR-Users] How to relay SIP messages to specific registered user in Kamailio?
Maybe you could try with uac module and this function
https://www.kamailio.org/docs/modules/devel/modules/uac.html#uac.f.uac_replace_to
Samuel Moya Tinoco Departamento de Sistemas y Redes
Móvil: (+34) 606985997 |
|
Soluciones inteligentes
|
|
De:
o.atef@fiberme.com <o.atef@fiberme.com>
Enviado el: martes, 2 de abril de 2024 12:38
Para: SAMUEL MOYA TINOCO <smoya@vivelibre.es>;
'Kamailio (SER) - Users Mailing List' <sr-users@lists.kamailio.org>
Asunto: RE: [SR-Users] How to relay SIP messages to specific registered user in Kamailio?
Hello Samuel,
I apreciate your response and I would like to clear my request that I want to route SIP message to different user wich is not included in URI, and lookup function just dealing with
pseudo-variables
and I wand to relay to static user like “test“.
May could you give me more information about it please?
Thank you,
From:
SAMUEL MOYA TINOCO <smoya@vivelibre.es>
Sent: Tuesday, April 2, 2024 12:29 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: o.atef@fiberme.com
Subject: RE: [SR-Users] How to relay SIP messages to specific registered user in Kamailio?
Hi Omar
You can check this function from registrar module
https://kamailio.org/docs/modules/5.8.x/modules/registrar.html#registrar.f.lookup
I use it to send SIP messages to several endpoints
De:
Omar Atef via sr-users <sr-users@lists.kamailio.org>
Enviado el: martes, 2 de abril de 2024 11:40
Para: sr-users@lists.kamailio.org
CC: o.atef@fiberme.com
Asunto: [SR-Users] How to relay SIP messages to specific registered user in Kamailio?
Hello guys,
I'm recently new player in Kamailio SIP server and want to use it as SIP proxy server to Asterisk PBX server.
first of all, I've successfully registered my Asterisk to Kamailio as user "test" to get its "location" because my Asterisk is behind NAT.
Simply now I want to relay SIP messages to this user's location to receive them all in Asterisk. After I searched, I found this function rewritehost()
but
it needs to be a host or IP address, but in my case I want some way or function to relay to user "test" and then it well get the user location from Kamailio datebase automatically?
I hope it's clear XD
I tried to find a way to do MSQL query in kamalio.cfg to get the user contact from "location" table and then relay to the result but it did not work. I guess that I
did it in wrong way but finally the Kamailio tutorials are so rare on google.
Thanks in advance,
Omar