Module: sip-router Branch: master Commit: 1f0341882763c34493f0ff5e6ab7dd4f5b4ff992 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1f034188...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Sun Jun 28 12:53:27 2009 +0200
mi_rpc: new module - rpc command to execute MI commands
- 'mi' rpc command can be used to execute K MI commands - example using sercmd: sercmd> mi uptime 200 OK
+ Now:: Sun Jun 28 12:45:37 2009 + Up since:: Sun Jun 28 12:24:27 2009 + Up time:: 1270 [sec]
---
modules/mi_rpc/Makefile | 18 +++ modules/mi_rpc/README | 84 +++++++++++++ modules/mi_rpc/doc/Makefile | 4 + modules/mi_rpc/doc/mi_rpc.xml | 43 +++++++ modules/mi_rpc/doc/mi_rpc_admin.xml | 103 ++++++++++++++++ modules/mi_rpc/mi_rpc_mod.c | 228 +++++++++++++++++++++++++++++++++++ 6 files changed, 480 insertions(+), 0 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=1f03...
Daniel-Constantin Mierla writes:
- 'mi' rpc command can be used to execute K MI commands
- example using sercmd:
sercmd> mi uptime 200 OK
sercmd> mi domain_dump 200 OK
+ :: test.fi + :: foo.bar sercmd> mi domain_reload 500 Domain table reload failed
sercmd> Jun 30 18:30:35 localhost /usr/sbin/sip-router[20064]: ERROR: <core> [db.c:422]: invalid parameter value Jun 30 18:30:35 localhost /usr/sbin/sip-router[20064]: ERROR: domain [domain.c:242]: Error while trying to use domain table
-- juha
On 06/30/2009 05:32 PM, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
- 'mi' rpc command can be used to execute K MI commands
- example using sercmd:
sercmd> mi uptime 200 OK
sercmd> mi domain_dump 200 OK
- :: test.fi
- :: foo.bar
sercmd> mi domain_reload 500 Domain table reload failed
sercmd> Jun 30 18:30:35 localhost /usr/sbin/sip-router[20064]: ERROR: <core> [db.c:422]: invalid parameter value Jun 30 18:30:35 localhost /usr/sbin/sip-router[20064]: ERROR: domain [domain.c:242]: Error while trying to use domain table
seems some MI commands needs a bit of review and fix to work over rpc, because in some cases they do not open db connection in all children, like it was with domain module. It opened only in the mi transport process. It should be fixed now. Let me know if works ok.
Daniel
Daniel-Constantin Mierla writes:
seems some MI commands needs a bit of review and fix to work over rpc, because in some cases they do not open db connection in all children, like it was with domain module. It opened only in the mi transport process. It should be fixed now. Let me know if works ok.
i works, but i'm wondering why the condition in child_init of modules_k/domain module is:
rank==PROC_RPC
but in modules/lcr it is:
#ifdef RPC_SUPPORT /* do nothing for the main process, tcp main process or timer */ if (rank==PROC_INIT || rank==PROC_MAIN || rank==PROC_TCP_MAIN || rank==PROC_TIMER) return 0; ...
-- juha
On Jul 01, 2009 at 09:11, Juha Heinanen jh@tutpro.com wrote:
Daniel-Constantin Mierla writes:
seems some MI commands needs a bit of review and fix to work over rpc, because in some cases they do not open db connection in all children, like it was with domain module. It opened only in the mi transport process. It should be fixed now. Let me know if works ok.
i works, but i'm wondering why the condition in child_init of modules_k/domain module is:
rank==PROC_RPC
but in modules/lcr it is:
#ifdef RPC_SUPPORT /* do nothing for the main process, tcp main process or timer */ if (rank==PROC_INIT || rank==PROC_MAIN || rank==PROC_TCP_MAIN || rank==PROC_TIMER) return 0;
It's the reverse, the condition in the domain module is for what processes to init the db, while in lcr is for what processes not to init the db (notice the return 0 if the condition is true).
In the domain module child_init the condition for initializing the db is: if ( (db_mode==0 && rank>0) || (rank==PROC_RPC) )
which is equivalent (for db_mode==0) with: rank!=PROC_MAIN && rank!=PROC_TIMER && rank!=PROC_TCP_MAIN && rank!=PROC_UNIXSOCK && rank!=PROC_ATTENDANT && rank!=PROC_INIT
(all the above ranks are <=0, all ranks < 0 are "special").
So compared to lcr it handles 2 more ranks PROC_UNIXSOCK & PROC_ATTENDANT , but PROC_UNIXSOCK is obsolete (it was another way to communicate with tm which is no longer used) and PROC_ATTENDANT is used for other stuff (is not used for child_init) => they are equivalent.
Andrei
Andrei Pelinescu-Onciul writes:
So compared to lcr it handles 2 more ranks PROC_UNIXSOCK & PROC_ATTENDANT , but PROC_UNIXSOCK is obsolete (it was another way to communicate with tm which is no longer used) and PROC_ATTENDANT is used for other stuff (is not used for child_init) => they are equivalent.
thanks for the explanation.
-- juha