Benny, thank you for the response. Python is not my language of choice or background. C just so happens to be. If it turns out to be 400 LoC so be it. All good programmers are lazy programmers and look to reuse. If nothing exists to draw on I'll give it a go on my own. Or consider using a sister asterisk system and the AGI interface for outbound calls in language of my choice. PJSIP just sounded appealing because I could write a stand alone app and place it anywhere to test w/o configuring an entire PBX. Thanks again. On Tue, Feb 10, 2009 at 7:12 AM, Benny Prijono <bennylp at teluu.com> wrote: > Matthew, your application logic is up to you to design and code of course, > but if I may suggest, Python sounds very much like the ideal platform for > apps like these. It's intriguing if you don't consider this. For a start, > it's 88 lines instead of 200 LoC [1], and the documentation is much better > too [2]. > > cheers > Benny > > [1] http://trac.pjsip.org/repos/wiki/Python_SIP/Hello_World > [2] http://trac.pjsip.org/repos/wiki/Python_SIP_Tutorial > > On Mon, Feb 9, 2009 at 8:40 PM, Matthew McAughan <matt.mcaughan at gmail.com>wrote: > >> Using the "200 lines of code" sample able to compile and place an outbound >> call no problem to an Asterisk PBX. But each example I see enters a tight >> loop and waits for the users to press 'q' to exit. >> >> I want to be able to do something once connected. Walk an IVR tree with >> DTMF to test that an IVR application is alive. Or play a message to the >> user, asking them to press X DTMF key to acknowledge they received the call. >> >> Not stuck on the DTMF generation or receipt but more the structure of the >> application. What is typically used here? Some sort of state machine that >> hooks in to the call state change callback to determine when connected, >> disconnected, etc...? Anyone have an example of this they would like to >> share? Something like below. >> >> >> >> #define MYAPP_STATE_DONE 0 >> #define MYAPP_STATE_SENDDTMF 1 >> #define MYAPP_STATE_LISTENDTMF 2 >> #define MYAPP_STATE_CONNECTED 3 >> #define MYAPP_STATE_DISCONNECTED 4 >> >> int myapp_state; >> >> static void on_call_state(pjsua_call_id call_id, pjsip_event *e) { >> >> pjsua_call_info ci; >> PJ_UNUSED_ARG(e); >> >> pjsua_call_get_info(call_id, &ci); >> if (ci.state == PJSIP_INV_STATE_DISCONNECTED) { >> myapp_state = MYAPP_STATE_DISCONNECTED; >> } >> } >> >> >> switch(myapp_ state) { >> >> case: PJSIP_CALL_ESTABLISHED >> myapp_state = MYAPP_STATE_SENDDTMF; >> break; >> >> case: MYAPP_STATE_SENDDTMF >> myapp_state = MYAPP_STATE_LISTENDTMF; >> break; >> >> case: MYAPP_STATE_LISTENDTMF >> myapp_state = MYAPP_STATE_DISCONNECTED; >> break; >> >> case: PJSIP_CALL_DISCONNECTED >> myapp_state = MYAPP_STATE_DONE; >> pjsua_destroy(); >> break; >> } >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip at lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090210/17d40148/attachment-0001.html>