Added call info enquiry MDP message.

This commit is contained in:
gardners 2012-04-20 05:38:45 +09:30
parent ea372aece2
commit cbb4df7c11
2 changed files with 28 additions and 0 deletions

View File

@ -1158,6 +1158,7 @@ typedef struct overlay_mdp_vompevent {
#define VOMPEVENT_WITHDRAWINTEREST (1<<8)
#define VOMPEVENT_CALLCREATED (1<<9)
#define VOMPEVENT_PICKUP (1<<10)
#define VOMPEVENT_CALLINFO (1<<11)
unsigned int flags;
unsigned short audio_sample_bytes;
unsigned char local_state;

27
vomp.c
View File

@ -261,6 +261,33 @@ int vomp_mdp_event(overlay_mdp_frame *mdp,
0,"Success. You were never listening.");
}
break;
case VOMPEVENT_CALLINFO:
{
/* provide call endpoint info to user */
vomp_call_state *call
=vomp_find_call_by_session(mdp->vompevent.call_session_token);
if (!call)
return overlay_mdp_reply_error
(mdp_named_socket,recvaddr,recvaddrlen,4006,
"No such call");
/* collect call info and send to requestor */
overlay_mdp_frame mdpreply;
bzero(&mdpreply,sizeof(mdpreply));
mdpreply.packetTypeAndFlags=MDP_VOMPEVENT;
mdpreply.vompevent.flags=VOMPEVENT_CALLINFO;
if (call->ringing) mdpreply.vompevent.flags|=VOMPEVENT_RINGING;
if (call->audio_started) mdpreply.vompevent.flags|=VOMPEVENT_AUDIOSTREAMING;
if (call->remote.state==VOMP_STATE_CALLENDED)
mdpreply.vompevent.flags|=VOMPEVENT_CALLENDED;
bcopy(call->local.sid,mdpreply.vompevent.local_sid,SID_SIZE);
bcopy(call->remote.sid,mdpreply.vompevent.remote_sid,SID_SIZE);
bcopy(call->local.did,mdpreply.vompevent.local_did,64);
bcopy(call->remote.did,mdpreply.vompevent.remote_did,64);
return overlay_mdp_reply(mdp_named_socket,recvaddr,recvaddrlen,&mdpreply);
}
break;
case VOMPEVENT_DIAL:
/* pull local_did and remote_did and start putting the call together.
These need to be passed to the node being called to provide caller id,