[SR-Users] Use constants in attrs column of the dispatcher module

Daniel-Constantin Mierla miconda at gmail.com
Fri Oct 22 15:40:36 CEST 2021


Hello,

Karsten's suggestion is indeed a good way.

The preprocessor for kamailio.cfg is tightly integrated in the config
interpreter, using lex/yacc to replace defined IDs with their associated
value, that code cannot be easily reused for dispatcher input. Probably
a simpler approach would be to evaluate attrs for variables, $def(ID)
returning the values of '#!define ID ...', because the internal API for
variables is available in modules, but it requires some C coding.

Cheers,
Daniel

On 20.10.21 09:38, Markus Bönke wrote:
> Hallo Karsten,
>
> thanks for the hint! With some modifications in my script it can work.
>
> Best regards
>
> Markus
>
>> Am 19.10.2021 um 16:21 schrieb Karsten Horsmann <khorsmann at gmail.com
>> <mailto:khorsmann at gmail.com>>:
>>
>> Hi Markus,
>>
>> not testet but looked at latest doc 'sockname' instead of socket
>> could be a solution.
>> So you label your sockets with "name" in the listen directive (in
>> config file) and use 'sockname' in dispatcher
>> table.https://kamailio.org/docs/modules/devel/modules/dispatcher.html#dispatcher.ex.attributes
>> <https://kamailio.org/docs/modules/devel/modules/dispatcher.html#dispatcher.ex.attributes>
>> listen=udp:1.2.3.4:5060 <http://1.2.3.4:5060/> name "sock1"
>>
>> Am Di., 19. Okt. 2021 um 15:13 Uhr schrieb Markus Bönke <mb at tenios.de
>> <mailto:mb at tenios.de>>:
>>
>>     Hello all,
>>
>>     I’ve a question regarding the dispatcher module. So far we use on
>>     every server a separate database table, where the attribute
>>     column is set to the local internal or external socket like
>>     "socket=udp:192.168.1.70:5060“ or socket=udp:80.239.xxx.xxx:5060.
>>     Is there a way to use constants here like
>>     socket=udp:IPADDR_INTERN:5060 or socket=udp:IPADDR_EXTERN:5060
>>     which are replaced when the data is loaded from the DB?
>>
>>
>>     Thanks and regards
>>
>>     Markus
>>     __________________________________________________________
>>     Kamailio - Users Mailing List - Non Commercial Discussions
>>       * sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>>     Important: keep the mailing list in the recipients, do not reply
>>     only to the sender!
>>     Edit mailing list options or unsubscribe:
>>       * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>     <https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>
>>
>>
>>
>> -- 
>> Mit freundlichen Grüßen
>> *Karsten Horsmann*
>> __________________________________________________________
>> Kamailio - Users Mailing List - Non Commercial Discussions
>>  * sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>> Important: keep the mailing list in the recipients, do not reply only
>> to the sender!
>> Edit mailing list options or unsubscribe:
>>  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>> <https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
Nov 08-11, 2021 (Europe Timezone) - Nov 22-25, 2021 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20211022/3898a42f/attachment.htm>


More information about the sr-users mailing list