Ok,

I guessed that the "terminal" in your email was CLI.

The user input from terminal is initialized in sofsip_init() function
in sofsip_cli.c file:

su_wait_create(&cli->cli_input, 0, SU_WAIT_IN);

cli_input is a su_wait_t object, and su_wait_t is pollfd for the
epoll/poll system call. Further, the second parameter "0" associates
this pollfd with stdin.

Subsequently, this polled is registered with a callback
"sofsip_handle_input" to the event loop "cli_root" (underlying may be
epoll/poll):

su_root_register(cli->cli_root,
                       &cli->cli_input,
                       sofsip_handle_input,
                       NULL,
                       0)

Therefore, whenever there is any input from this stdin, the main event
loop will return, and call sofsip_handle_input, which will execute
corresponding functions according to CLI commands (such as i, list,
set, etc).

Therefore, in your case, you'll probably still need to register a
su_wait_t object to the main event loop. The difference is, in order
to interact with sofsip_cli from your widget, you need associate the
su_wait_t object with an external input source from your widget GUI
rather than stdin (0) when calling su_wait_create.

Or maybe you don't need to register a su_wait_t to event loop? Just
call python binding of functions like makeCall from your javascript
widget? I am not sure.

Hope this would help.

BR

Tan

On Tue, Oct 7, 2008 at 9:11 PM, Fan Xing <[EMAIL PROTECTED]> wrote:
> Hi,
>
>    Thanks for your explaination.
>
>    I try to implement three C functions
>
> 1. InitVoip function that does all the initilazation (memory allocation, sip
> signaling, media system, etc).
> 2. runLoop (su_root_run()) that starts the event loop, listen to callback.
> 3. Cleanup function that does all the deinitilazation.
>
>   What I do not need is the command line interface (because I use widget to
> interact with user, not command). I wonder which function in sofsip_cli
> starts the terminal for user to input command? I want to disable this part.
>
>   I wonder when and where the terminal is started? Thanks for your kind
> help!
>
> Xing
>
>
>> Date: Tue, 7 Oct 2008 18:10:58 +0300
>> From: [EMAIL PROTECTED]
>> To: [EMAIL PROTECTED]
>> Subject: Re: sofsip_cli, which function starts the command terminal?
>>
>> Hi,
>>
>> What do you mean by "terminal is invoked"? Do you mean that sofsip_cli
>> starts running?
>>
>> If so, then I will try to explain you su_root_t and nua_t in sofia-sip
>> library.
>>
>> su_root_t represents the main event loop of the protocol stack. For
>> instance, you can think about it as an encapsulation of epoll
>> function. su_root_create() initializes an instance of su_root_t
>> object.
>>
>> nua_t is the user agent on top of the main event loop. You create an
>> instance of UA and register the callback function to proceed NUA
>> events with nua_create(). ssc_create() calls nua_create().
>>
>> After creating the root object (which represents the main event loop)
>> and nua object, you can start running the main event loop by calling
>> su_root_run(). Therefore, I guess the runLoop() is the actual function
>> you are looking for.
>>
>> --------------------------
>>
>> Well, but from your main function, this seems not what you mean.... As
>> you obviously want to start the client from main.
>>
>
> ________________________________
> Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie.
> Learn Now



-- 
Best Regards
Tan Miaoqing
Software engineer, Maemo Software
Nokia Devices R&D
http://users.tkk.fi/~mitan

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to