From cbb4df7c11ed8a72b8ee6e8f0d4a8445456883ef Mon Sep 17 00:00:00 2001 From: gardners Date: Fri, 20 Apr 2012 05:38:45 +0930 Subject: [PATCH] Added call info enquiry MDP message. --- serval.h | 1 + vomp.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/serval.h b/serval.h index 545d8666..88271bbc 100644 --- a/serval.h +++ b/serval.h @@ -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; diff --git a/vomp.c b/vomp.c index a93ba559..b559d5e7 100644 --- a/vomp.c +++ b/vomp.c @@ -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,