Hi ppl,
Need to replace origination carrier's domain with my own, so I do:
branch_route[MANAGE_PSTN_IN_BRANCH] {
uac_replace_from("sip:$fU@mydomain.net");
}
The dialog-forming INVITE is relayed properly with ONLY the domain part
being replaced.
However, subsequent messages such as ACK and BYE have the From DISPLAY NAME
(_uac_fdp) stripped off.
Not that it affects real functionality in any known way (CLID is still good
for callee), but curious if this is intentional or not, as
*uac_replace_from(uri)* clearly states that: "*Replace in FROM header the
URI part without altering the display name*"
# kamcmd dlg.list
variables: {
{
_uac_fdpnew:
}
{
_uac_fdp: "JOHN DOE"
}
{
_uac_funew: sip:18661112222@mydomain.net
}
{
_uac_fu: sip:18661112222@carrierdomain.net
}
Thanks!
I added $du=$null; before route(RELAY) as you suggested but I get the same results:
Nov 8 12:40:22 spock /usr/sbin/kamailio[21826]: ERROR: <script>: transaction canceled
Nov 8 12:40:22 spock /usr/sbin/kamailio[21826]: ERROR: <script>: #012 RDNIS = sip:297@192.168.1.134
Nov 8 12:40:22 spock /usr/sbin/kamailio[21826]: ERROR: <script>: =============forwarding to voicemail1, RDNIS: sip:297@192.168.1.134 ===========
Nov 8 12:40:22 spock /usr/sbin/kamailio[21826]: ERROR: tm [tm.c:1679]: _w_t_relay_to(): t_forward_noack failed
Nov 8 12:40:22 spock /usr/sbin/kamailio[21826]: ERROR: sl [sl_funcs.c:392]: sl_reply_error(): stateless error reply used: transaction canceled (487/SL)
Regards,
Konstantinos
> On Fri Nov 8 10:24:06 CET 2019 Daniel Tryba wrote:
>
>> On Thu, Nov 07, 2019 at 04:53:43PM +0200, Konstantinos Merentitis wrote:
>>
>> I tried to modify the failure route in order to also forward not answered (failed?) calls to asterisk mailbox but i get the following error and the call is never forwarded:
>>
> You appear to do the same thing I do, except setting $du to null. If the user is REGISTERed $du will be set to their endpoint, changing $ru will have no effect on routing. So add $du=$null; in the TOVOICEMAIL route before route(RELAY) and see what happens.
>
I would like to forward all incoming calls that are not answered from kamailio, to my asterisk voicemail server. - I have not setup any Realtime Integration.
I am using the "Redirected Dialed Number Information Service" header and calling "554(a)192.168.1.134" which is my voicemail server.
Forwarding succeeds when the subscriber is not registered to kamailio:
Nov 7 16:19:45 spock /usr/sbin/kamailio[17606]: ERROR: <script>: =============User sip:6297@192.168.1.131 not found here, going to voicemail=============
Nov 7 16:19:45 spock /usr/sbin/kamailio[17606]: ERROR: <script>: #012 RDNIS = sip:297@192.168.1.134
Nov 7 16:19:45 spock /usr/sbin/kamailio[17606]: ERROR: <script>: =============forwarding to voicemail1, RDNIS: sip:297@192.168.1.134 ===========
I tried to modify the failure route in order to also forward not answered (failed?) calls to asterisk mailbox but i get the following error and the call is never forwarded:
Nov 7 16:19:25 spock /usr/sbin/kamailio[17609]: ERROR: <script>: transaction canceled
Nov 7 16:19:25 spock /usr/sbin/kamailio[17609]: ERROR: <script>: #012 RDNIS = sip:297@192.168.1.134
Nov 7 16:19:25 spock /usr/sbin/kamailio[17609]: ERROR: <script>: =============forwarding to voicemail1, RDNIS: sip:297@192.168.1.134 ===========
Nov 7 16:19:25 spock /usr/sbin/kamailio[17609]: ERROR: tm [tm.c:1679]: _w_t_relay_to(): t_forward_noack failed
Nov 7 16:19:25 spock /usr/sbin/kamailio[17609]: ERROR: sl [sl_funcs.c:392]: sl_reply_error(): stateless error reply used: transaction canceled (487/SL)
failure and voicemail routes are slightly modified from the default config:
route[LOCATION] {
#!ifdef WITH_SPEEDDIAL
# search for short dialing - 2-digit extension
if($rU=~"^[0-9][0-9]$") {
if(sd_lookup("speed_dial")) {
route(SIPOUT);
}
}
#!endif
#!ifdef WITH_ALIASDB
# search in DB-based aliases
if(alias_db_lookup("dbaliases")) {
route(SIPOUT);
}
#!endif
$avp(oexten) = $rU;
if (!lookup("location")) {
xlog("=============User $ru not found here, going to voicemail=============\n");
$var(rc) = $rc;
route(TOVOICEMAIL);
t_newtran();
switch ($var(rc)) {
case -1:
case -3:
send_reply("404", "Not Found");
exit;
case -2:
send_reply("405", "Method Not Allowed");
exit;
}
}
# when routing via usrloc, log the missed calls also
if (is_method("INVITE")) {
setflag(FLT_ACCMISSED);
}
route(RELAY);
exit;
}
route[TOVOICEMAIL] {
#!ifdef WITH_VOICEMAIL
if(!is_method("INVITE|SUBSCRIBE")) return;
# check if VoiceMail server IP is defined
if (strempty($sel(cfg_get.voicemail.srv_ip))) {
xlog("SCRIPT: VoiceMail routing enabled but IP not defined\n");
return;
}
if(is_method("INVITE")) {
$var(RDNIS)=$di;
xlog("\n RDNIS = $var(RDNIS) \n");
if($avp(oexten)==$null) return;
# $ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip + ";transport=udp")
# + ":" + $sel(cfg_get.voicemail.srv_port);
xlog("=============forwarding to voicemail1, RDNIS: $di =========== ");
$ru = "sip:554@192.168.1.134:5060";
} else {
if($rU==$null) return;
# $ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip + ";transport=udp")
# + ":" + $sel(cfg_get.voicemail.srv_port);
xlog("=============forwarding to voicemail2, RDNIS: $di =========== ");
$ru = "sip:554@192.168.1.134:5060";
}
route(RELAY);
exit;
#!endif
return;
}
# Manage failure routing cases
failure_route[MANAGE_FAILURE] {
route(NATMANAGE);
if (t_is_canceled()) {
#modified here
xlog("transaction canceled\n");
route(TOVOICEMAIL);
#exit;
#/modified
}
#!ifdef WITH_BLOCK3XX
# block call redirect based on 3xx replies.
if (t_check_status("3[0-9][0-9]")) {
t_reply("404","Not found");
exit;
}
#!endif
#!ifdef WITH_BLOCK401407
# block call redirect based on 401, 407 replies.
if (t_check_status("401|407")) {
t_reply("404","Not found");
exit;
}
#!endif
#!ifdef WITH_VOICEMAIL
# serial forking
# - route to voicemail on busy or no answer (timeout)
if (t_check_status("486|408")) {
$du = $null;
xlog("============= Route failure, forwarding to voicemail =============");
route(TOVOICEMAIL);
exit;
}
#!endif
}
Dears..
how is possibile to read that data 9052562462354464 inside the first
INVITE message
=== Example ===
U 2019/11/07 14:46:59.320936 192.168.1.1:5060 -> 192.168.1.242:5060
INVITE sip:9052562462354464@192.168.1.242 SIP/2.0.
Record-Route:
<sip:192.168.1.1;lr;ftag=105854496;did=24e.e751;vst=AAAAAAAAAwQAAAAAAAAAAAAAAAAADQIAAwEDAAAHDwAGBAg1MDYw;nat=yes>.
Max-Forwards: 66.
Via: SIP/2.0/UDP
51.254.158.40:5060;branch=z9hG4bK501c.87a8e402c8f1cf93192ddd8e6744da57.1.
From: "38617774738" <sip:38617774738@10.1.1.1>;tag=105854496.
To: <sip:562462354464@192.168.1.242>.
Call-ID: 1573138018-1602381967(a)10.1.1.182.
CSeq: 20215490 INVITE
..... ETC ETC...
Thanks to all
I need to send re-invite after pacemaker fails over on new rtpengine
server. Because new rtpengine dont participate in DTLS handshake and i hear
nothing, but silence. I think, may me its would be work. Do you have any
idea on this issue?
Hello Mailinglist,
i try to figure out, how to solve RE-INVITES and SRTP:
i have an kamailio route names route[MEDIAPROXY] that i used to controll
rtpengine in an private and public ip setup. This works fine for me now.
It use the permission module and the adress table to figure out
$var(mediagroup) = allow_address_group($Ri, 0); received from internal or
external ip.
The idea is from SBC-OS chamless stolen, so thanks for that.
So fare so good. I adapted SRTP also to this.
But on RE-INVITES it stops handling SRTP correctly to the encryption
upstream.
And i am sure, its my fault. But i have no clue how to detect that
correctly.
Any hints where i can read more about an correct handling on this?
Here my main-config file / kamailio 5.3.x and rtpengine.
https://gist.github.com/khorsmann/02bd98a628a190caee68fc3d876a3448
--
Mit freundlichen Grüßen
*Karsten Horsmann*
On Wed, Nov 06, 2019 at 07:15:42PM +0100, Igor Olhovskiy wrote:
>
> Hm... Maybe there is other module to achieve such functions?
> Best if it would be with cache :)
> But if no - regex also fine.
But if it works it works! I don't think there is a specific module to do
this but it is easy to implement yourself. What I don't like personally
about your solution is the use of the permission tables, you need
atleast 1 per user (unless users have the same ip).
Personally I do this by direct database queries in usr_preferences on
INVITEs and REGISTERs. You could use any database (depending on how you
store the ACL) and cache it in a htable.
My solution is mysql specific (inet_aton) and forces users to have
atleast 1 CIDR notated subnet:
if(!avp_db_query("select value from usr_preferences where username='$au' and attribute='acl' and
inet_aton(substring_index(value,'/',1))&(1 << 32) - 1 & ~((1 << (32 -
substring_index(value,'/',-1))) - 1)=inet_aton('$si')&(1 << 32) -
1 & ~((1 << (32 - substring_index(value,'/',-1))) - 1)"))
{
t_reply("404","Go away");
exit;
}
Hi,
I am using NDB_MONGODB to ask some questions to a database.
My database structure is pretty heavy, so I like to return as little data as required to Kamailio.
I have tried the following MongoDB syntax for projection to include only given (my_field) column in the response.
mongodb_find_one("srv_name", "database", "collection", "{ \"user_id\" : \"$var(user_id)\" }, { \"my_field\" : 1}", "mgr1")
I always get full DB entry back. Is this supported?
The same string works OK in the vanilla mongo client.
How can I limit the result?
Thanks
Lars