User Tools

Site Tools


cookbooks:5.2.x:core

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cookbooks:5.2.x:core [2019/10/30 00:18]
joelsdc
cookbooks:5.2.x:core [2019/10/30 00:27]
joelsdc
Line 3013: Line 3013:
  
 The sub-route blocks allow to make the configuration file modular, simplifying the logic and helping to avoid duplication of actions. The sub-route blocks allow to make the configuration file modular, simplifying the logic and helping to avoid duplication of actions.
- 
 ==== branch_route ==== ==== branch_route ====
  
Line 3115: Line 3114:
   }   }
 </code> </code>
 +==== onsend_route ====
 +
 +The route is executed in when a SIP request is sent out. Only a limited number of commands are allowed (drop, if + all the checks, msg flag manipulations, send(), log(), textops::search()).
 +
 +In this route the final destination of the message is available and can be checked (with snd_ip, snd_port, to_ip, to_port, snd_proto, snd_af).
 +
 +This route is executed only when forwarding requests - it is not executed for replies, retransmissions, or locally generated messages (e.g. via fifo uac).
 +
 +Example:
 +
 +<code c>
 +  onsend_route {
 +    if(to_ip==1.2.3.4 && !isflagset(12)){
 +      log(1, "message blocked\n");
 +      drop;
 +    }
 +  }
 +</code>
 +
 +  * snd_ip, snd_port - behave like src_ip/src_port, but contain the ip/port Kamailio will use to send the message
 +  * to_ip, to_port - like above, but contain the ip/port the message will be sent to (not to be confused with dst_ip/dst_port, which are the destination of the original received request: Kamailio's ip and port on which the message was received)
 +  * snd_proto, snd_af - behave like proto/af but contain the protocol/address family that Kamailio will use to send the message
 +  * msg:len - when used in an onsend_route, msg:len will contain the length of the message on the wire (after all the changes in the script are applied, Vias are added a.s.o) and not the lentgh of the original message.
cookbooks/5.2.x/core.txt ยท Last modified: 2020/04/03 09:34 by henningw