|
From: Andrea S. <si...@op...> - 2008-10-27 14:43:51
|
Hi all,
I'm trying to understand what's the exact state change
pattern during a call placed by iaxclient. That's a
session log of a call involving a working phone number:
10/27/08 02:42:36 PM call(-1) received text: 'Originating an audio only call'
10/27/08 02:42:36 PM call(0) state: outgoing
10/27/08 02:42:36 PM call(0) state: active outgoing
10/27/08 02:42:36 PM call(-1) received text: 'Call 0 accepted'
10/27/08 02:42:36 PM call(0) state: active outgoing ringing
10/27/08 02:42:36 PM call(-1) received text: 'Call 0 ringing'
10/27/08 02:42:36 PM call(0) state: active outgoing complete
10/27/08 02:42:36 PM call(-1) received text: 'Call 0 progress'
10/27/08 02:42:44 PM call(0) state: active outgoing complete
10/27/08 02:42:44 PM call(-1) received text: 'Call 0 answered'
Using infos delivered by text events I can detect the state change
pattern that identify an answered call (ringing -> progress -> answered),
whereas using only info retrieved by state events the pattern to an
answered phone call has an "ambiguous" state change:
"active outgoing"
"active outgoing ringing"
"active outgoing complete" <------ (IAX_EVENT_VOICE)
"active outgoing complete" <------ (IAX_EVENT_ANSWER)
As far as I understand looking at iaxclient_lib.c the state change
notification logic is contained in:
static void iaxc_handle_network_event(struct iax_event *e, int callNo)
and that's the chunk of code that handle those two IAX2 events
case IAX_EVENT_VOICE:
handle_audio_event(e, callNo);
if ( (calls[callNo].state & IAXC_CALL_STATE_OUTGOING) &&
(calls[callNo].state & IAXC_CALL_STATE_RINGING) )
{
calls[callNo].state &= ~IAXC_CALL_STATE_RINGING;
calls[callNo].state |= IAXC_CALL_STATE_COMPLETE;
iaxci_do_state_callback(callNo);
iaxci_usermsg(IAXC_STATUS,"Call %d progress",
callNo);
}
break;
case IAX_EVENT_ANSWER:
calls[callNo].state &= ~IAXC_CALL_STATE_RINGING;
calls[callNo].state |= IAXC_CALL_STATE_COMPLETE;
iaxci_do_state_callback(callNo);
iaxci_usermsg(IAXC_STATUS,"Call %d answered", callNo);
//iaxc_answer_call(callNo);
// notify the user?
break;
I was wondering if that behaviour is due to the IAX2 protocol definition
itself (e.g. lack of state definition for a PROGRESS state event), or if
there's something missing elsewhere (e.g. iaxci_post_event or iaxci_do_state_callback)?
And more to the point is there a way that you can think of
that let me identify an answered call based on state event
notifications only?
thank you
Andrea
|