Greetings Again List.
After being unable to use ndb_cassandra with kamailio I tried to use app_python. Below is relevant configuration.
version: kamailio 4.4.2 (x86_64/linux) 892ad6 flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: 892ad6 compiled on 07:50:03 Jul 1 2016 with gcc 4.9.2
modparam("app_python", "script_name", "/usr/local/kamailio/etc/kamailio/handler.py")
request_route { ..... python_exec("handler"); ..... }
And i am using example provided in app_python module. *But i soon as i import Cassandra driver in script*. Kamailio terminate with there logs.
Jul 1 19:57:19 debian ./kamailio[8643]: INFO: app_python [mod_Logger.c:170]: logger_LM_INFO(): test.child_init(20) Jul 1 19:57:19 debian ./kamailio[8642]: INFO: app_python [mod_Logger.c:170]: logger_LM_INFO(): test.child_init(19) Jul 1 19:57:19 debian ./kamailio[8648]: DEBUG: <core> [sr_module.c:920]: init_mod_child(): rank -4: tmx Jul 1 19:57:19 debian ./kamailio[8648]: DEBUG: tmx [tmx_mod.c:275]: child_init(): rank is (-4) Jul 1 19:57:19 debian ./kamailio[8648]: DEBUG: <core> [sr_module.c:920]: init_mod_child(): rank -4: sl Jul 1 19:57:19 debian ./kamailio[8616]: INFO: <core> [main.c:754]: handle_sigs(): terminating due to SIGCHLD Jul 1 19:57:19 debian ./kamailio[8642]: DEBUG: <core> [local_timer.c:61]: init_local_timer(): timer_list between 0xa78988 and 0xabc988 Jul 1 19:57:19 debian ./kamailio[8642]: DEBUG: <core> [io_wait.h:376]: io_watch_add(): DBG: io_watch_add(0xa787c0, 40, 1, (nil)), fd_no=0 Jul 1 19:57:19 debian ./kamailio[8644]: DEBUG: <core> [sr_module.c:920]: init_mod_child(): rank 21: kex Jul 1 19:57:19 debian ./kamailio[8645]: DEBUG: kex [kex_mod.c:161]: child_init(): rank is (22) Jul 1 19:57:19 debian ./kamailio[8640]: DEBUG: kex [kex_mod.c:161]: child_init(): rank is (17) Jul 1 19:57:19 debian ./kamailio[8639]: DEBUG: mi_rpc [mi_rpc_mod.c:104]: child_init(): initializing child[-2] for rpc handling Jul 1 19:57:19 debian ./kamailio[8646]: DEBUG: <core> [sr_module.c:920]: init_mod_child(): rank 23: tm Jul 1 19:57:19 debian ./kamailio[8641]: DEBUG: <core> [sr_module.c:920]: init_mod_child(): rank 18: corex Jul 1 19:57:19 debian ./kamailio[8635]: INFO: app_python [mod_Logger.c:170]: logger_LM_INFO(): test.child_init(-1) Jul 1 19:57:19 debian ./kamailio[8648]: DEBUG: <core> [sr_module.c:920]: init_mod_child(): rank -4: usrloc Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: <core> [main.c:756]: handle_sigs(): terminating due to SIGCHLD Jul 1 19:57:19 debian ./kamailio[8636]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8621]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8620]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8625]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8623]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8638]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8624]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8632]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8647]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8633]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8637]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8619]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8622]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8626]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8627]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8628]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8629]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8642]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8630]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8635]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8631]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8634]: INFO: <core> [main.c:809]: sig_usr(): signal 15 received Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: tm [t_funcs.c:86]: tm_shutdown(): DEBUG: tm_shutdown : start Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: tm [t_funcs.c:89]: tm_shutdown(): DEBUG: tm_shutdown : emptying hash table Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: tm [t_funcs.c:91]: tm_shutdown(): DEBUG: tm_shutdown : removing semaphores Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: tm [t_funcs.c:93]: tm_shutdown(): DEBUG: tm_shutdown : destroying tmcb lists Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: tm [t_funcs.c:96]: tm_shutdown(): DEBUG: tm_shutdown : done Jul 1 19:57:19 debian ./kamailio[8616]: INFO: <core> [sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: <core> [mem/shm.c:174]: shm_core_lock_destroy(): destroying the shared memory lock Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: <core> [mem/shm.c:266]: shm_destroy_manager(): destroying memory manager: f_malloc Jul 1 19:57:19 debian ./kamailio[8616]: DEBUG: <core> [mem/pkg.c:89]: pkg_destroy_manager(): destroying memory manager: f_malloc
I have tried using two different drivers for Cassandra in python but same results.
I wonder if i import mysql driver kamailio starts perfectly.
Below it my script.
#!/usr/bin/python import sys import pymysql *import pycassa* from Router.Logger import LM_ERR from Router.Logger import LM_INFO
class test: def __init__(self): LM_INFO('test.__init__\n')
def child_init(self, y): LM_INFO('test.child_init(%d)\n' % y) return 0
def handler(self, msg): LM_INFO('test.handler(%s)\n' % (msg.Type)) if msg.Type == 'SIP_REQUEST': if msg.Method == 'INVITE': LM_INFO("Re-writing RURI") msg.rewrite_ruri('sip:0022@192.168.2.24:5073') LM_INFO('SIP request, method = %s, RURI = %s, From = %s\n' % (msg.Method, msg.RURI, msg.getHeader('from'))) LM_INFO('received from %s:%d\n' % msg.src_address) return 1
def mod_init(): return test()
Any help is much appreciated.
Best Regards, Aqs Younas