Hi,
The documentation states the following. https://www.kamailio.org/wiki/cookbooks/4.2.x/core#myself
if(uri==myself) { log("the request is for local processing\n"); };
Now this could also be used to do something like this: (also used in some examples)
if(from_uri==myself) { log("the request is for local processing\n"); };
Using this the from_uri could be: sip:sip.voipexample.net:5061 myself in this case only has sip.voipexample.net:5060 as an Aias
Now the equation wouldn't match, because the port 5061 is non-default. Would it be possible to match the from_uri to myself ignoring the port in from_uri? The only thing I can think of is using a regular expression. somthing like this:
from_uri=~"sip:.+@sip.voipexample.net(:([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])|)"
But this skips the use of myself entirely. Any insight on this would be greatly appreciated!
Cheers, Dirk
Hello,
try with is_myself("sip:$fU@fd").
That is a function that matches the same addresses as myself condition.
Cheers, Daniel
On 22/01/16 11:05, Dirk Teurlings - SIGNET B.V. wrote:
Hi,
The documentation states the following. https://www.kamailio.org/wiki/cookbooks/4.2.x/core#myself
if(uri==myself) { log("the request is for local processing\n"); };
Now this could also be used to do something like this: (also used in some examples)
if(from_uri==myself) { log("the request is for local processing\n"); };
Using this the from_uri could be: sip:sip.voipexample.net:5061 myself in this case only has sip.voipexample.net:5060 as an Aias
Now the equation wouldn't match, because the port 5061 is non-default. Would it be possible to match the from_uri to myself ignoring the port in from_uri? The only thing I can think of is using a regular expression. somthing like this:
from_uri=~"sip:.+@sip.voipexample.net(:([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])|)"
But this skips the use of myself entirely. Any insight on this would be greatly appreciated!
Cheers, Dirk
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 22-01-16 11:31, Daniel-Constantin Mierla wrote:
try with is_myself("sip:$fU@fd").
Hi Daniel,
Thanks for the quick response. Comparing the from_uri to myself should only compare IP or domain name correct? So wouldn't this be enough as a domain check?
is_myself("$fd")
Cheers, Dirk
it is possible to use is_myself("$fd"), but there are some issues: if you listen on IP like "listen=xxx.xxx.xxx.xxx", $fd have to be reverse DNS lookup for this IP ; alias http://www.kamailio.org/wiki/cookbooks/devel/core#alias and auto_aliases http://www.kamailio.org/wiki/cookbooks/devel/core#auto_aliases parameters may be very useful for tuning is_myself domain name behaviour
2016-01-22 19:10 GMT+03:00 Dirk Teurlings - SIGNET B.V. < dteurlings@signet.nl>:
On 22-01-16 11:31, Daniel-Constantin Mierla wrote:
try with is_myself("sip:$fU@fd").
Hi Daniel,
Thanks for the quick response. Comparing the from_uri to myself should only compare IP or domain name correct? So wouldn't this be enough as a domain check?
is_myself("$fd")
Cheers, Dirk
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello,
On 22/01/16 17:10, Dirk Teurlings - SIGNET B.V. wrote:
On 22-01-16 11:31, Daniel-Constantin Mierla wrote:
try with is_myself("sip:$fU@fd").
Hi Daniel,
Thanks for the quick response. Comparing the from_uri to myself should only compare IP or domain name correct? So wouldn't this be enough as a domain check?
is_myself("$fd")
I am not sure if it works with domain only, but should work with sip:domain, like is_myself("sip:$fd") -- it might be that the function requires a sip uri as aparameter, but indeed the user part doesn't count, I provided the example more for showing how to get rid of parameters from From header uri.
Cheers, Daniel
according to docs it takes IP as well: *uri* - Valid SIP URI or IP address to check against the list of local IP addresses or domains.
In my instance it works with domain only (version 4.2 checked)
2016-01-25 11:22 GMT+03:00 Daniel-Constantin Mierla miconda@gmail.com:
Hello,
On 22/01/16 17:10, Dirk Teurlings - SIGNET B.V. wrote:
On 22-01-16 11:31, Daniel-Constantin Mierla wrote:
try with is_myself("sip:$fU@fd").
Hi Daniel,
Thanks for the quick response. Comparing the from_uri to myself should only compare IP or domain name correct? So wouldn't this be enough as a domain check?
is_myself("$fd")
I am not sure if it works with domain only, but should work with sip:domain, like is_myself("sip:$fd") -- it might be that the function requires a sip uri as aparameter, but indeed the user part doesn't count, I provided the example more for showing how to get rid of parameters from From header uri.
Cheers, Daniel
-- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Book: SIP Routing With Kamailio - http://www.asipto.com http://miconda.eu
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
OK, thanks for confirming with the docs, I was not sure about it anymore, although I wrote is_myself() function for config (too many functions to remember by heart, that's why I do open source, to check the code :-) ) -- knowing that works always with a sip address, I just wanted to point and try with sip uri in case is not working with address alone.
It should not matter the version, there was no change to is_myself() in the recent releases....
Cheers, Daniel
On 25/01/16 09:32, Dmitri Savolainen wrote:
according to docs it takes IP as well: /uri/ - Valid SIP URI or IP address to check against the list of local IP addresses or domains.
In my instance it works with domain only (version 4.2 checked)
2016-01-25 11:22 GMT+03:00 Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com>:
Hello, On 22/01/16 17:10, Dirk Teurlings - SIGNET B.V. wrote: > On 22-01-16 11:31, Daniel-Constantin Mierla wrote: >> try with is_myself("sip:$fU@fd"). > Hi Daniel, > > Thanks for the quick response. Comparing the from_uri to myself should > only compare IP or domain name correct? So wouldn't this be enough as a > domain check? > > is_myself("$fd") I am not sure if it works with domain only, but should work with sip:domain, like is_myself("sip:$fd") -- it might be that the function requires a sip uri as aparameter, but indeed the user part doesn't count, I provided the example more for showing how to get rid of parameters from From header uri. Cheers, Daniel -- Daniel-Constantin Mierla http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> - http://www.linkedin.com/in/miconda Book: SIP Routing With Kamailio - http://www.asipto.com http://miconda.eu _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Savolainen Dmitri