Kamailio branch基础知识

这里讲的都是kamailio很基础的知识

$ru = "sip:192.168.1.100";

t_relay();

exit;

这是最简单的路由,这段路由创建了一个branch,叫main branch

下面这段复杂了一点点:

$du = "sip:192.168.1.100";

$ru = "sip:abc.com";

t_relay();

exit;

跟上面那段路由相比,就是多了一个步骤,设置了sip代理,请留意$du和$ru的区别

下面这段更复杂一点:

$du = "sip:192.168.1.100";

$ru = "sip:abc.com";

append_branch("sip:192.168.1.101"); # additional branches

t_relay();

exit;

除了main branch之外,还增加了一个branch

更复杂一点,读取数据库,创建多个branch,可以参考这里:

建议留意miconda的表述:

Be aware that r-uri (request uri, represented by $ru as var) it is itself a branch. Also $du (outbound proxy - destination uri) is associated with the $ru branch.

In the config snippet, you assign values to $du, that means you set the destination address for the branch of r-uri ($ru). because you only use append branch, you don't change the r-uri branch and that stays as extra branch with latest $du you set.

What you should do:

if $var(i)==0 (the first row of the result) - set the $ru to the contact and the $du to received value
if $var(i)!=0 do append_branch with contact and set the (branch(dst_uri)-1) to received value
 

你可能感兴趣的:(Kamailio,Kamailio,branch)