Console app to hang-up a number, if not picking

RB
Rachel Baskaran
Mon, Sep 28, 2009 5:21 PM

Hey all,

I figured to hangup and quit, once 'h' is pressed.
Now I need a console app to quit pjsua if the person doesn't pick my call ,
like case scenario.

Any Help!

Hey all, I figured to hangup and quit, once 'h' is pressed. Now I need a console app to quit pjsua if the person doesn't pick my call , like case scenario. Any Help!
SI
Saúl Ibarra
Mon, Sep 28, 2009 6:43 PM

Check the mediastate callback. You should check for the status code,
for example is its 408 you could exit...

On Mon, Sep 28, 2009 at 7:21 PM, Rachel Baskaran
rachelbaskaran@gmail.com wrote:

Hey all,

I figured to hangup and quit, once 'h' is pressed.
Now I need a console app to quit pjsua if the person doesn't pick my call ,
like case scenario.

Any Help!


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Check the mediastate callback. You should check for the status code, for example is its 408 you could exit... On Mon, Sep 28, 2009 at 7:21 PM, Rachel Baskaran <rachelbaskaran@gmail.com> wrote: > Hey all, > > I figured to hangup and quit, once 'h' is pressed. > Now I need a console app to quit pjsua if the person doesn't pick my call , > like case scenario. > > Any Help! > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > -- /Saúl http://www.saghul.net | http://www.sipdoc.net
RB
Rachel Baskaran
Mon, Sep 28, 2009 6:56 PM

Is there a code as below for this issue too?

for(;;){
/* Console option for hangup and quit */
char option[10];

puts("Press h to hangup all calls");
if(fgets(option, sizeof(option), stdin) == NULL){
puts("EOF while reading stdin, will quit now...");
break;
}

/if(option[0] == 'q')
break;
/

if(option[0] == 'h')
pjsua_call_hangup_all();
break;
}

/* Destroy PJSUA on quit */
pjsua_destroy();
return 0;
}

Can I quit the app automatically,if the call is taking long to respond me?

I'm looking for something like that.

Rachel

On Mon, Sep 28, 2009 at 2:43 PM, Saúl Ibarra saghul@gmail.com wrote:

Check the mediastate callback. You should check for the status code,
for example is its 408 you could exit...

On Mon, Sep 28, 2009 at 7:21 PM, Rachel Baskaran
rachelbaskaran@gmail.com wrote:

Hey all,

I figured to hangup and quit, once 'h' is pressed.
Now I need a console app to quit pjsua if the person doesn't pick my call

,

Is there a code as below for this issue too? for(;;){ /* Console option for hangup and quit */ char option[10]; puts("Press h to hangup all calls"); if(fgets(option, sizeof(option), stdin) == NULL){ puts("EOF while reading stdin, will quit now..."); break; } /*if(option[0] == 'q') break;*/ if(option[0] == 'h') pjsua_call_hangup_all(); break; } /* Destroy PJSUA on quit */ pjsua_destroy(); return 0; } Can I quit the app automatically,if the call is taking long to respond me? I'm looking for something like that. Rachel On Mon, Sep 28, 2009 at 2:43 PM, Saúl Ibarra <saghul@gmail.com> wrote: > Check the mediastate callback. You should check for the status code, > for example is its 408 you could exit... > > On Mon, Sep 28, 2009 at 7:21 PM, Rachel Baskaran > <rachelbaskaran@gmail.com> wrote: > > Hey all, > > > > I figured to hangup and quit, once 'h' is pressed. > > Now I need a console app to quit pjsua if the person doesn't pick my call > , > > like case scenario. > > > > Any Help! > > > > _______________________________________________ > > Visit our blog: http://blog.pjsip.org > > > > pjsip mailing list > > pjsip@lists.pjsip.org > > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > > > > > -- > /Saúl > http://www.saghul.net | http://www.sipdoc.net > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >
RB
Rachel Baskaran
Mon, Sep 28, 2009 9:09 PM

If the above is not possible. The only other option I can think of is
setting a timer. But I'm not sure how to do that.

Any help would be great!

Rachel

On Mon, Sep 28, 2009 at 2:56 PM, Rachel Baskaran
rachelbaskaran@gmail.comwrote:

Is there a code as below for this issue too?

for(;;){
/* Console option for hangup and quit */
char option[10];

puts("Press h to hangup all calls");
if(fgets(option, sizeof(option), stdin) == NULL){
puts("EOF while reading stdin, will quit now...");
break;
}

/if(option[0] == 'q')
break;
/

if(option[0] == 'h')
pjsua_call_hangup_all();
break;
}

/* Destroy PJSUA on quit */
pjsua_destroy();
return 0;
}

Can I quit the app automatically,if the call is taking long to respond me?

I'm looking for something like that.

Rachel

On Mon, Sep 28, 2009 at 2:43 PM, Saúl Ibarra saghul@gmail.com wrote:

Check the mediastate callback. You should check for the status code,
for example is its 408 you could exit...

On Mon, Sep 28, 2009 at 7:21 PM, Rachel Baskaran
rachelbaskaran@gmail.com wrote:

Hey all,

I figured to hangup and quit, once 'h' is pressed.
Now I need a console app to quit pjsua if the person doesn't pick my

call ,

If the above is not possible. The only other option I can think of is setting a timer. But I'm not sure how to do that. Any help would be great! Rachel On Mon, Sep 28, 2009 at 2:56 PM, Rachel Baskaran <rachelbaskaran@gmail.com>wrote: > Is there a code as below for this issue too? > > for(;;){ > /* Console option for hangup and quit */ > char option[10]; > > puts("Press h to hangup all calls"); > if(fgets(option, sizeof(option), stdin) == NULL){ > puts("EOF while reading stdin, will quit now..."); > break; > } > > /*if(option[0] == 'q') > break;*/ > > if(option[0] == 'h') > pjsua_call_hangup_all(); > break; > } > > /* Destroy PJSUA on quit */ > pjsua_destroy(); > return 0; > } > > Can I quit the app automatically,if the call is taking long to respond me? > > I'm looking for something like that. > > Rachel > > > On Mon, Sep 28, 2009 at 2:43 PM, Saúl Ibarra <saghul@gmail.com> wrote: > >> Check the mediastate callback. You should check for the status code, >> for example is its 408 you could exit... >> >> On Mon, Sep 28, 2009 at 7:21 PM, Rachel Baskaran >> <rachelbaskaran@gmail.com> wrote: >> > Hey all, >> > >> > I figured to hangup and quit, once 'h' is pressed. >> > Now I need a console app to quit pjsua if the person doesn't pick my >> call , >> > like case scenario. >> > >> > Any Help! >> > >> > _______________________________________________ >> > Visit our blog: http://blog.pjsip.org >> > >> > pjsip mailing list >> > pjsip@lists.pjsip.org >> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> > >> > >> >> >> >> -- >> /Saúl >> http://www.saghul.net | http://www.sipdoc.net >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> > >
SI
Saúl Ibarra
Mon, Sep 28, 2009 10:14 PM

Read the documentation on the callbacks. There is a callback which is
called when the media state is changed. You should implement that in
the callback. A timer is definitely NOT a clean solution.

--
/Saúl
http://www.saghul.net | http://www.sipdoc.net

Read the documentation on the callbacks. There is a callback which is called when the media state is changed. You should implement that in the callback. A timer is definitely NOT a clean solution. -- /Saúl http://www.saghul.net | http://www.sipdoc.net
RB
Rachel Baskaran
Tue, Sep 29, 2009 2:38 PM

Hey Saul,

I tried as below, it works but it only rings for 4 times and then takes me
to the person's message box. I already have a callback for media and
on_call_state.

if(argc < 1)
{
pjsua_call_hangup(call_id, PJSIP_SC_TEMPORARILY_UNAVAILABLE, NULL, NULL);
}

Is there a way to increase the number of rings, 4 is too short I guess?

If this works, I need to try the transfer thing.

Rachel

On Mon, Sep 28, 2009 at 6:14 PM, Saúl Ibarra saghul@gmail.com wrote:

Read the documentation on the callbacks. There is a callback which is
called when the media state is changed. You should implement that in
the callback. A timer is definitely NOT a clean solution.

--
/Saúl
http://www.saghul.net | http://www.sipdoc.net


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hey Saul, I tried as below, it works but it only rings for 4 times and then takes me to the person's message box. I already have a callback for media and on_call_state. if(argc < 1) { pjsua_call_hangup(call_id, PJSIP_SC_TEMPORARILY_UNAVAILABLE, NULL, NULL); } Is there a way to increase the number of rings, 4 is too short I guess? If this works, I need to try the transfer thing. Rachel On Mon, Sep 28, 2009 at 6:14 PM, Saúl Ibarra <saghul@gmail.com> wrote: > Read the documentation on the callbacks. There is a callback which is > called when the media state is changed. You should implement that in > the callback. A timer is definitely NOT a clean solution. > > > > -- > /Saúl > http://www.saghul.net | http://www.sipdoc.net > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >
RB
Rachel Baskaran
Tue, Sep 29, 2009 4:46 PM

I even tried as below, but no luck.

static void on_call_media_state(pjsua_call_id call_id)
{
pjsua_call_info ci;

 pjsua_call_get_info(call_id, &ci);

 if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) {
     // When media is active, connect call to sound device.
     pjsua_conf_connect(ci.conf_slot, 0);
     pjsua_conf_connect(0, ci.conf_slot);
 }
 if(ci.media_status == PJSUA_CALL_MEDIA_ERROR){
 PJ_LOG(3,(THIS_FILE,"Media has reported error, disconnecting call"));
 pj_str_t reason = pj_str("Takes too long to respond");

pjsua_call_hangup(call_id,PJSIP_SC_TEMPORARILY_UNAVAILABLE,&reason,NULL);
}
if(ci.media_status == PJSUA_CALL_MEDIA_NONE){
PJ_LOG(3,(THIS_FILE, "Media for call %d is inactive", call_id));
}
}

I'm not sure what am I missing here?

Rachel

On Tue, Sep 29, 2009 at 10:38 AM, Rachel Baskaran
rachelbaskaran@gmail.comwrote:

Hey Saul,

I tried as below, it works but it only rings for 4 times and then takes me
to the person's message box. I already have a callback for media and
on_call_state.

if(argc < 1)
{
pjsua_call_hangup(call_id, PJSIP_SC_TEMPORARILY_UNAVAILABLE, NULL, NULL);
}

Is there a way to increase the number of rings, 4 is too short I guess?

If this works, I need to try the transfer thing.

Rachel

On Mon, Sep 28, 2009 at 6:14 PM, Saúl Ibarra saghul@gmail.com wrote:

Read the documentation on the callbacks. There is a callback which is
called when the media state is changed. You should implement that in
the callback. A timer is definitely NOT a clean solution.

--
/Saúl
http://www.saghul.net | http://www.sipdoc.net


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

I even tried as below, but no luck. static void on_call_media_state(pjsua_call_id call_id) { pjsua_call_info ci; pjsua_call_get_info(call_id, &ci); if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) { // When media is active, connect call to sound device. pjsua_conf_connect(ci.conf_slot, 0); pjsua_conf_connect(0, ci.conf_slot); } if(ci.media_status == PJSUA_CALL_MEDIA_ERROR){ PJ_LOG(3,(THIS_FILE,"Media has reported error, disconnecting call")); pj_str_t reason = pj_str("Takes too long to respond"); pjsua_call_hangup(call_id,PJSIP_SC_TEMPORARILY_UNAVAILABLE,&reason,NULL); } if(ci.media_status == PJSUA_CALL_MEDIA_NONE){ PJ_LOG(3,(THIS_FILE, "Media for call %d is inactive", call_id)); } } I'm not sure what am I missing here? Rachel On Tue, Sep 29, 2009 at 10:38 AM, Rachel Baskaran <rachelbaskaran@gmail.com>wrote: > Hey Saul, > > I tried as below, it works but it only rings for 4 times and then takes me > to the person's message box. I already have a callback for media and > on_call_state. > > if(argc < 1) > { > pjsua_call_hangup(call_id, PJSIP_SC_TEMPORARILY_UNAVAILABLE, NULL, NULL); > } > > Is there a way to increase the number of rings, 4 is too short I guess? > > If this works, I need to try the transfer thing. > > Rachel > > > On Mon, Sep 28, 2009 at 6:14 PM, Saúl Ibarra <saghul@gmail.com> wrote: > >> Read the documentation on the callbacks. There is a callback which is >> called when the media state is changed. You should implement that in >> the callback. A timer is definitely NOT a clean solution. >> >> >> >> -- >> /Saúl >> http://www.saghul.net | http://www.sipdoc.net >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> > >