<p>=== Description ===<br>
use $sel() in event_route from evapi module will cause segfault and kamailio crash.</p>

<p>=== How to re-produce ===</p>

<p>--- Step 1. kamailio.cfg: ---</p>

<h1>--- evapi params ---</h1>

<p>loadmodule "evapi.so"<br>
modparam("evapi", "bind_addr", "127.0.0.1:8448")<br>
modparam("evapi", "netstring_format", 1)<br>
modparam("evapi", "workers", 4)</p>

<h1>--- set a custom options outside any route block</h1>

<p>self.MYIP = "1.2.3.4"</p>

<h1>--- set event_route for evapi and invoke $sel;  both route will segfault and crash</h1>

<p>event_route[evapi:connection-new] {<br>
    xlog("L_NOTICE", "[ROUTEDEBUG][evapi:connection-new] new connection from $evapi(srcaddr):$evapi(srcport)");<br>
    xlog("L_NOTICE", "[ROUTEDEBUG][evapi:connection-new] TEST sel: $sel(cfg_get.self.MYIP)");<br>
}<br>
event_route[evapi:message-received] {<br>
    xlog("L_NOTICE", "[ROUTEDEBUG][evapi:message-received] test sel: $sel(cfg_get.self.MYIP)");<br>
}</p>

<p>--- 2. try connect to evapi ---</p>

<p>You can use any client to try to connect or send message.<br>
in bash, you can just use the following command to connect to and send a message:</p>

<p>exec 3<>/dev/tcp/127.0.0.1/5014; printf "5:Hello," >&3;</p>

<p>=== Debug level 3 error log at event_route[evapi:connection-new]  ===</p>

<p>Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47034]: NOTICE: </p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/kamailio/kamailio/issues/287">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZZDKGNb3bVaOCNHqeudnyjRNvUe1ks5omwVKgaJpZM4FqDy-.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/287"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>