Changeset 407:d614a9d10bff in verona
- Timestamp:
- Jan 17, 2012 4:23:34 PM (16 months ago)
- Branch:
- default
- Parents:
- 406:31a03b808483 (diff), 405:0772b54c47c0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- phapi
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
phapi/phapi.c
r403 r407 125 125 static char *ph_get_call_contact(phcall_t *ca); 126 126 127 #define MEDIA_SUSPEND128 129 #ifndef PH_STREAM_AUDIO127 //#define MEDIA_SUSPEND 128 129 /*#ifndef PH_STREAM_AUDIO 130 130 #define PH_STREAM_AUDIO (1 << 0) 131 131 #define PH_STREAM_VIDEO_RX (1 << 1) 132 132 #define PH_STREAM_VIDEO_TX (1 << 2) 133 #endif 133 #endif*/ 134 134 135 135 #define PH_STREAM_CNG (1 << 30) … … 188 188 static int ph_call_media_stop(phcall_t * ca); 189 189 static int ph_call_media_suspend(phcall_t *ca, int localhold); 190 191 enum ph_direction 192 { 193 sendrecv, 194 sendonly, 195 recvonly, 196 inactive 197 }; 198 199 enum ph_direction ph_get_media_direction( sdp_message_t * sdp, const char * media_type); 200 enum ph_direction ph_get_local_media_direction( phcall_t *ca, const char * media_type); 201 int ph_set_media_direction( sdp_message_t * sdp, const char *media_type, enum ph_direction direction); 202 const char * ph_get_str_direction( enum ph_direction direction); 190 203 191 204 #define nonempty(x) ((x) && (x)[0]) … … 1205 1218 int pos = 0; 1206 1219 1207 if (!_is_audio_enabled(ca-> nego_mflags))1220 if (!_is_audio_enabled(ca->user_mflags)) 1208 1221 return 0; 1209 1222 … … 1246 1259 struct vline* vl; 1247 1260 1248 if (!_is_video_enabled(ca-> nego_mflags))1261 if (!_is_video_enabled(ca->user_mflags)) 1249 1262 return 0; 1250 1263 … … 2918 2931 } 2919 2932 2920 PHAPI_EXPORT int 2921 phResumeCall(int cid) 2922 { 2923 phcall_t *ca; 2933 int _ph_send_reinvite(int cid) 2934 { 2924 2935 int i; 2925 2936 osip_message_t *reinvite; 2926 char *body;2927 2937 phcall_t *ca; 2938 2928 2939 if (!phIsInitialized) 2929 2940 return -PH_NOTINIT; 2930 2941 2931 2942 ca = ph_locate_call_by_cid(cid); 2932 2943 2933 2944 if (!ca) 2934 2945 return -PH_BADCID; 2935 2936 if (!ca->localhold) 2937 return -PH_HOLDERR; 2938 2939 #ifndef CONF_MODE 2940 if (ph_has_active_calls()) 2941 return -PH_NORESOURCES; 2942 #endif 2943 2944 ca->localhold = 0; 2945 ca->localresume = 1; 2946 2946 2947 2947 eXosip_lock(); 2948 2948 if (eXosip_call_build_request(ca->did, "INVITE", &reinvite)) { … … 2952 2952 eXosip_unlock(); 2953 2953 2954 osip_message_set_subject(reinvite, "Call re suming");2954 osip_message_set_subject(reinvite, "Call reinvite"); 2955 2955 osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO"); 2956 2957 body = ph_call_fix_media_dir(ca, "sendrecv"); 2958 if (!body) 2959 return -PH_HOLDERR; 2960 if (body) 2961 ph_req_set_body(reinvite, body, "application/sdp"); 2962 2956 2957 sdp_context_build_offer(ca->sdpctx); 2958 2959 ph_set_media_direction(ca->sdpctx->offer, "audio", ph_get_local_media_direction(ca, "audio")); 2960 ph_set_media_direction(ca->sdpctx->offer, "video", ph_get_local_media_direction(ca, "video")); 2961 2962 sdp_message_to_str(ca->sdpctx->offer, &ca->sdpctx->offerstr); 2963 2964 ca->local_sdp = ca->sdpctx->offer; 2965 ca->remote_sdp = 0; // force ph_call_media_start on ph_call_answered 2966 ph_req_set_body(reinvite, ca->sdpctx->offerstr, "application/sdp"); 2963 2967 2964 2968 eXosip_lock(); … … 2966 2970 eXosip_unlock(); 2967 2971 2972 osip_mutex_lock(ph_media_stop_mutex); 2973 ph_call_media_stop(ca); 2974 osip_mutex_unlock(ph_media_stop_mutex); 2975 2968 2976 return i; 2977 } 2978 2979 PHAPI_EXPORT int 2980 phResumeCall(int cid) 2981 { 2982 phcall_t *ca; 2983 2984 if (!phIsInitialized) 2985 return -PH_NOTINIT; 2986 2987 ca = ph_locate_call_by_cid(cid); 2988 2989 if (!ca) 2990 return -PH_BADCID; 2991 2992 ca->nego_mflags |= PH_STREAM_AUDIO_RX; 2993 ca->nego_mflags |= PH_STREAM_VIDEO_RX; 2994 2995 ca->localhold = 0; 2996 ca->localresume = 1; 2997 2998 return _ph_send_reinvite(cid); 2969 2999 } 2970 3000 … … 2973 3003 { 2974 3004 phcall_t *ca; 2975 osip_message_t *reinvite;2976 int i;2977 char *body;2978 2979 DBG_SIP_NEGO("SIP_NEGO: phHoldCall\n");2980 3005 2981 3006 if (!phIsInitialized) … … 2987 3012 return -PH_BADCID; 2988 3013 2989 if (ca->localhold) 2990 return -PH_HOLDERR; 2991 3014 ca->nego_mflags &= ~PH_STREAM_AUDIO_RX; 3015 ca->nego_mflags &= ~PH_STREAM_VIDEO_RX; 3016 3017 ca->localresume = 0; 2992 3018 ca->localhold = 1; 2993 2994 eXosip_lock(); 2995 if (eXosip_call_build_request(ca->did, "INVITE", &reinvite)) { 2996 eXosip_unlock(); 2997 return -1; 2998 } 2999 eXosip_unlock(); 3000 3001 osip_message_set_subject(reinvite, "Call on hold"); 3002 osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO"); 3003 body = ph_call_fix_media_dir(ca, "sendonly"); 3004 if (!body) 3005 return -PH_HOLDERR; 3006 if (body) 3007 ph_req_set_body(reinvite, body, "application/sdp"); 3008 3009 eXosip_lock(); 3010 i = eXosip_call_send_request(ca->did, reinvite); 3011 eXosip_unlock(); 3012 3013 osip_mutex_lock(ph_media_stop_mutex); 3014 if (!i && ph_call_hasaudio(ca)) 3015 { 3016 #ifndef MEDIA_SUSPEND 3017 ph_call_media_stop(ca); 3018 #else 3019 ph_call_media_suspend(ca, 1); 3020 #endif 3021 } 3022 osip_mutex_unlock(ph_media_stop_mutex); 3023 return i; 3019 3020 return _ph_send_reinvite(cid); 3024 3021 } 3025 3022 … … 5106 5103 ph_call_media_start(phcall_t *ca, eXosip_event_t *je, int flags, int resumeflag) 5107 5104 { 5108 int i = 0;5109 5105 int use_socket; 5106 int result = 0; 5110 5107 struct ph_msession_s *s = NULL; 5111 5108 const char* ptime = getenv("EXOSIP_FORCE_PTIME"); … … 5117 5114 5118 5115 // cases when the invocation is ignored 5119 if (phcfg.nomedia || ca-> localhold || ca->remotehold)5116 if (phcfg.nomedia || ca->remotehold) 5120 5117 { 5121 5118 return 0; … … 5140 5137 s->audio_conf = NULL; 5141 5138 s->activestreams = 0; 5139 s->dtmfCallback = ph_wegot_dtmf; 5140 s->endCallback = ph_stream_ended; 5141 s->qosInfoCbk = ph_qos_info_cbk; 5142 s->frameDisplayCbk = ph_frame_display_cbk; 5142 5143 } 5143 5144 else … … 5163 5164 s->newstreams = 0; 5164 5165 5165 if ( // user accepts video and network accepts video 5166 (_is_video_enabled(ca->user_mflags)) 5167 && ca->video_payload 5168 && ca->remote_sdp_video_ip[0] 5169 ) 5170 { 5171 // negociated flags (user+SDP) need to be IO 5172 ca->nego_mflags = ca->nego_mflags | PH_STREAM_VIDEO_RX; 5173 ca->nego_mflags = ca->nego_mflags | PH_STREAM_VIDEO_TX; 5174 5175 DBG_SIP_NEGO("will have video stream ip: %s payload=%d\n", ca->remote_sdp_video_ip, ca->video_payload); 5176 DBG_SIP_NEGO("media flags may have changed: user= %d nego=%d\n", ca->user_mflags, ca->nego_mflags); 5177 } 5178 else 5179 { 5180 // video is not negociated 5181 // it is necessary to remove VIDEO IO flags 5182 ca->nego_mflags = ca->nego_mflags & ~PH_STREAM_VIDEO_RX; 5183 ca->nego_mflags = ca->nego_mflags & ~PH_STREAM_VIDEO_TX; 5184 5185 DBG_SIP_NEGO("media flags may have changed: user= %d nego=%d\n", ca->user_mflags, ca->nego_mflags); 5186 } 5187 5188 if ( _is_video_enabled(ca->nego_mflags) ) 5166 if ( _is_video_enabled(ca->nego_mflags) && ca->video_payload && ca->remote_sdp_video_ip[0] && osip_strcasecmp(ca->remote_sdp_video_ip, "0")) 5189 5167 { 5190 5168 struct ph_mstream_params_s *msp = &s->streams[PH_MSTREAM_VIDEO1]; … … 5195 5173 5196 5174 // define the traffic type of the stream 5197 ttype = _is_video_enabled(ca-> user_mflags);5175 ttype = _is_video_enabled(ca->nego_mflags); 5198 5176 if (ttype == (PH_STREAM_VIDEO_RX | PH_STREAM_VIDEO_TX)) 5199 5177 { … … 5233 5211 5234 5212 // define the video callback 5235 s->frameDisplayCbk = ph_frame_display_cbk;5213 5236 5214 5237 5215 // additional configuration for video … … 5245 5223 } 5246 5224 5247 if ( // audio is enabled 5248 _is_audio_enabled(ca->nego_mflags) 5249 && (!ca || ca->remote_sdp_audio_ip[0]) 5250 ) 5225 if (_is_audio_enabled(ca->nego_mflags) && ca->remote_sdp_audio_ip[0] && osip_strcasecmp(ca->remote_sdp_audio_ip, "0")) 5251 5226 { 5252 5227 struct ph_mstream_params_s *msp = &s->streams[PH_MSTREAM_AUDIO1]; 5228 int ttype = 0; 5253 5229 5254 5230 //TODO uncomment it after the work un payloads … … 5269 5245 s->newstreams |= (1 << PH_MSTREAM_AUDIO1); 5270 5246 5271 s->dtmfCallback = ph_wegot_dtmf;5272 s->endCallback = ph_stream_ended;5273 s->qosInfoCbk = ph_qos_info_cbk;5274 5275 5247 if (phcfg.vad & 0x80000000) 5276 5248 { … … 5291 5263 } 5292 5264 5293 msp->traffictype = PH_MSTREAM_TRAFFIC_IO; 5265 ttype = _is_audio_enabled(ca->nego_mflags); 5266 if (ttype == (PH_STREAM_AUDIO_RX | PH_STREAM_AUDIO_TX)) 5267 { 5268 msp->traffictype = PH_MSTREAM_TRAFFIC_IO; 5269 } 5270 else if (ttype == PH_STREAM_AUDIO_RX) 5271 { 5272 msp->traffictype = PH_MSTREAM_TRAFFIC_IN; 5273 } 5274 else if (ttype == PH_STREAM_AUDIO_TX) 5275 { 5276 msp->traffictype = PH_MSTREAM_TRAFFIC_OUT; 5277 } 5278 5294 5279 msp->localport = ca->loc_sdp_audio_port; 5295 5280 … … 5336 5321 5337 5322 // take action depending on the streaming configuration 5338 if (s->newstreams | s->activestreams) 5339 { 5340 if (resumeflag) 5341 { 5342 if (ph_msession_resume(s, PH_MSTREAM_TRAFFIC_IO, phcfg.audio_dev_in, phcfg.audio_dev_out, use_socket)) 5343 { 5344 DBG_SIP_NEGO("SIP_NEGO:ph_call_media_start: just called ph_msession_resume\n"); 5345 i = -PH_NOMEDIA; 5346 } 5347 } 5348 else if (ph_msession_start(s, ca->audiodev_in, ca->audiodev_out, use_socket)) 5323 if (s->newstreams || s->activestreams) 5324 { 5325 if (ph_msession_start(s, ca->audiodev_in, ca->audiodev_out, use_socket)) 5349 5326 { 5350 5327 DBG_SIP_NEGO("SIP_NEGO:ph_call_media_start: just called ph_msession_start\n"); 5351 i= -PH_NOMEDIA;5328 result = -PH_NOMEDIA; 5352 5329 } 5353 5330 } … … 5355 5332 { 5356 5333 DBG_SIP_NEGO("SIP_NEGO:ph_call_media_start: nothing to start\n"); 5357 i= -PH_NOMEDIA;5334 result = -PH_NOMEDIA; 5358 5335 } 5359 5336 5360 5337 osip_mutex_unlock(ph_media_start_mutex); 5361 5338 5362 return i;5339 return result; 5363 5340 } 5364 5341 … … 5568 5545 info.remoteSdp = sdp = ph_req_get_body(je->response); 5569 5546 5570 if (!ca->localhold)5547 //if (!ca->localhold) 5571 5548 { 5572 5549 const int mflags = -1 & ~(PH_STREAM_MCSEND|PH_STREAM_MCRECV); … … 5588 5565 DBG_SIP_NEGO("ph_call_answered: different sdp restarting streams\n"); 5589 5566 } 5590 ph_call_media_stop(ca);5591 5567 sdp_message_free(ca->remote_sdp); 5592 5568 } 5569 ph_call_media_stop(ca); 5593 5570 ca->remote_sdp = new_sdp; 5594 5571 ca->sdpctx->answer = ca->remote_sdp; 5572 osip_list_special_free(&ca->result_audio_payloads, sdp_payload_free); 5573 osip_list_special_free(&ca->result_video_payloads, sdp_payload_free); 5595 5574 sdp_context_process_answer(ca->sdpctx, ca->remote_sdp); 5596 5575 ph_call_retrieve_payloads(ca, -1); 5597 5576 5577 ph_update_nego_mflags(ca,ph_get_media_direction(new_sdp,"audio"),ph_get_media_direction(new_sdp,"video")); 5578 5598 5579 if (ph_call_media_start(ca, je, mflags, ca->localresume)) 5599 5580 { … … 5685 5666 rca = ph_locate_call_by_cid(ca->rcid); 5686 5667 5687 if (ca && !ca->localrefer )5668 if (ca && !ca->localrefer && !ca->localhold && !ca->localresume) 5688 5669 { 5689 5670 ph_call_retrieve_payloads(ca, PH_STREAM_CNG); … … 6176 6157 6177 6158 info.vlid = ca->vlid; 6178 if (ph_call_hasaudio(ca) || ph_call_hasvideo(ca))6159 /*if (ph_call_hasaudio(ca) || ph_call_hasvideo(ca)) 6179 6160 { 6180 6161 #ifndef MEDIA_SUSPEND … … 6183 6164 ph_call_media_suspend(ca, 0); 6184 6165 #endif 6185 } 6166 }*/ 6186 6167 6187 6168 ca->remotehold = 1; … … 6211 6192 ca->remotehold = 0; 6212 6193 6213 if (ph_call_hasaudio(ca) || ph_call_hasvideo(ca)) {6194 /*if (ph_call_hasaudio(ca) || ph_call_hasvideo(ca)) { 6214 6195 ph_call_retrieve_payloads(ca, -1); 6215 6196 ph_call_media_resume(ca, !remotehold); 6216 } 6197 }*/ 6217 6198 6218 6199 if (remotehold) { … … 6229 6210 #define keywordcmp(key,str) strncmp(key,str,strlen(key)) 6230 6211 6231 void 6212 int ph_set_media_direction( sdp_message_t * sdp, const char *media_type, enum ph_direction direction) 6213 { 6214 int mline =0; 6215 6216 for (mline=0; !sdp_message_endof_media (sdp, mline); mline++) 6217 { 6218 const char * mtype = sdp_message_m_media_get(sdp, mline); 6219 if(!osip_strcasecmp(media_type, mtype)) 6220 { 6221 const char * sdir = ph_get_str_direction(direction); 6222 sdp_message_a_attribute_del(sdp, mline, "inactive"); 6223 sdp_message_a_attribute_del(sdp, mline, "sendonly"); 6224 sdp_message_a_attribute_del(sdp, mline, "sendrecv"); 6225 sdp_message_a_attribute_add(sdp, mline, osip_strdup(sdir), 0); 6226 6227 return 0; 6228 } 6229 } 6230 return -1; 6231 } 6232 6233 enum ph_direction ph_get_local_media_direction( phcall_t *ca, const char * media_type) 6234 { 6235 if(!osip_strcasecmp(media_type, "audio")) 6236 { 6237 if(ca->nego_mflags & PH_STREAM_AUDIO_TX && ca->nego_mflags & PH_STREAM_AUDIO_RX) 6238 return sendrecv; 6239 if(ca->nego_mflags & PH_STREAM_AUDIO_TX) 6240 return sendonly; 6241 if(ca->nego_mflags & PH_STREAM_AUDIO_RX) 6242 return recvonly; 6243 } 6244 else if(!osip_strcasecmp(media_type, "video")) 6245 { 6246 if(ca->nego_mflags & PH_STREAM_VIDEO_TX && ca->nego_mflags & PH_STREAM_VIDEO_RX) 6247 return sendrecv; 6248 if(ca->nego_mflags & PH_STREAM_VIDEO_TX) 6249 return sendonly; 6250 if(ca->nego_mflags & PH_STREAM_VIDEO_RX) 6251 return recvonly; 6252 } 6253 6254 return inactive; 6255 } 6256 6257 enum ph_direction ph_get_media_direction( sdp_message_t * sdp, const char * media_type) 6258 { 6259 int mline = 0; 6260 for (mline=0; !sdp_message_endof_media (sdp, mline); mline++) 6261 { 6262 int i =0; 6263 sdp_attribute_t *attr; 6264 const char * mtype = sdp_message_m_media_get(sdp, mline); 6265 if(!osip_strcasecmp(media_type, mtype)) 6266 { 6267 for (i=0;(attr=sdp_message_attribute_get(sdp,mline,i))!=NULL;i++) 6268 { 6269 if ( keywordcmp("sendrecv",attr->a_att_field) == 0 ) 6270 { 6271 return sendrecv; 6272 } 6273 else if( keywordcmp("sendonly",attr->a_att_field) == 0 ) 6274 { 6275 return sendonly; 6276 } 6277 else if( keywordcmp("recvonly",attr->a_att_field) == 0 ) 6278 { 6279 return recvonly; 6280 } 6281 else if( keywordcmp("inactive",attr->a_att_field) == 0 ) 6282 { 6283 return inactive; 6284 } 6285 } 6286 6287 return sendrecv; 6288 } 6289 } 6290 return inactive; 6291 } 6292 6293 int ph_update_nego_mflags( phcall_t *ca, enum ph_direction remote_audio_direction, enum ph_direction remote_video_direction) 6294 { 6295 switch(remote_audio_direction) 6296 { 6297 case sendrecv: 6298 ca->nego_mflags |= PH_STREAM_AUDIO; 6299 break; 6300 6301 case sendonly: 6302 ca->nego_mflags &= ~PH_STREAM_AUDIO_TX; 6303 //ca->nego_mflags |= PH_STREAM_AUDIO_RX; 6304 break; 6305 6306 case recvonly: 6307 ca->nego_mflags &= ~PH_STREAM_AUDIO_RX; 6308 ca->nego_mflags |= PH_STREAM_AUDIO_TX; 6309 break; 6310 6311 case inactive: 6312 ca->nego_mflags &= ~PH_STREAM_AUDIO; 6313 break; 6314 } 6315 6316 switch(remote_video_direction) 6317 { 6318 case sendrecv: 6319 ca->nego_mflags |= PH_STREAM_VIDEO; 6320 break; 6321 6322 case sendonly: 6323 ca->nego_mflags &= ~PH_STREAM_VIDEO_TX; 6324 //ca->nego_mflags |= PH_STREAM_VIDEO_RX; 6325 break; 6326 6327 case recvonly: 6328 ca->nego_mflags &= ~PH_STREAM_VIDEO_RX; 6329 ca->nego_mflags |= PH_STREAM_VIDEO_TX; 6330 break; 6331 6332 case inactive: 6333 ca->nego_mflags &= ~PH_STREAM_VIDEO; 6334 break; 6335 } 6336 6337 return 0; 6338 } 6339 6340 const char * ph_get_str_direction( enum ph_direction direction) 6341 { 6342 switch(direction) 6343 { 6344 case sendrecv: 6345 return "sendrecv"; 6346 break; 6347 6348 case sendonly: 6349 return "sendonly"; 6350 break; 6351 6352 case recvonly: 6353 return "recvonly"; 6354 break; 6355 6356 case inactive: 6357 return "inactive"; 6358 break; 6359 } 6360 6361 return ""; 6362 } 6363 6364 int 6232 6365 ph_call_reinvite(eXosip_event_t *je) 6233 6366 { 6234 int is_sendrec = 0; 6367 int i = 0; 6368 int isHeld = 0; 6235 6369 int mline = 0; 6236 sdp_message_t * msg = eXosip_get_sdp_info(je->request); 6237 6238 for (mline=0; !sdp_message_endof_media (msg, mline); mline++) { 6239 int i; 6240 sdp_attribute_t *attr; 6241 const char * mtype = sdp_message_m_media_get(msg, mline); 6242 if (strcasecmp("audio", mtype) == 0){ 6243 //is audio 6244 } 6245 /*else if (strcasecmp("video", mtype) == 0){ 6246 //is video 6247 }*/ 6248 else 6249 continue; 6250 6251 for (i=0;(attr=sdp_message_attribute_get(msg,mline,i))!=NULL;i++) { 6252 if (keywordcmp("sendrecv",attr->a_att_field)==0){ 6253 is_sendrec = 1; 6254 }/*else if (keywordcmp("sendonly",attr->a_att_field)==0){ 6255 is_sendrec = 0; 6256 }else if (keywordcmp("recvonly",attr->a_att_field)==0){ 6257 is_sendrec = 0; 6258 }else if (keywordcmp("inactive",attr->a_att_field)==0){ 6259 is_sendrec = 0; 6260 }*/ 6261 } 6262 break; 6263 } 6264 6265 ph_answer_request(je->cid, je->tid, 200, 0); 6266 6267 if(is_sendrec) 6370 phcall_t *ca = 0; 6371 sdp_message_t * sdp = 0; 6372 struct vline *vl; 6373 osip_message_t *msg = 0; 6374 char *body = NULL; 6375 struct ph_msession_s * msession; 6376 6377 ca = ph_locate_call(je, 0); 6378 6379 if (!ca) 6380 return -PH_BADCID; 6381 6382 vl = ph_valid_vlid(ca->vlid); 6383 6384 if (!vl) 6385 return -PH_BADVLID; 6386 6387 msession = ca->mses; 6388 6389 sdp = eXosip_get_sdp_info(je->request); 6390 6391 ca->sdpctx->offer = ca->remote_sdp = sdp; 6392 6393 i = eXosip_call_build_answer(ca->tid, 200, &msg); 6394 if (i < 0) 6395 { 6396 return -1; 6397 } 6398 6399 osip_list_special_free(&ca->result_audio_payloads, sdp_payload_free); 6400 osip_list_special_free(&ca->result_video_payloads, sdp_payload_free); 6401 6402 if (sdp_context_build_answer(ca->sdpctx, ca->remote_sdp, phcfg.ptime) == NULL) 6403 { 6404 eXosip_call_send_answer(ca->tid, 606, NULL); //error, no matching payload 6405 eXosip_unlock(); 6406 return -1; 6407 } 6408 6409 ph_call_media_stop(ca); 6410 ph_update_nego_mflags(ca, ph_get_media_direction(sdp,"audio"), ph_get_media_direction(sdp,"video")); 6411 ph_set_media_direction(ca->sdpctx->answer, "audio", ph_get_local_media_direction(ca, "audio")); 6412 ph_set_media_direction(ca->sdpctx->answer, "video", ph_get_local_media_direction(ca, "video")); 6413 6414 if (ca->sdpctx->answerstr!=NULL) { 6415 osip_free(ca->sdpctx->answerstr); 6416 ca->sdpctx->answerstr = 0; 6417 } 6418 6419 sdp_message_to_str(ca->sdpctx->answer, &ca->sdpctx->answerstr); 6420 6421 ca->local_sdp = ca->sdpctx->answer; 6422 ph_req_set_body(msg, ca->sdpctx->answerstr, "application/sdp"); 6423 i = eXosip_call_send_answer(ca->tid, 200, msg); 6424 ph_call_media_start(ca, je, 0, 0); 6425 /* 6426 if(isHeld) 6427 ph_call_onhold(je); 6428 else 6268 6429 ph_call_offhold(je); 6269 else 6270 ph_call_onhold(je);6430 */ 6431 return 0; 6271 6432 } 6272 6433 -
phapi/phapi.c
r406 r407 169 169 static NatType ph_stun_nat_type = StunTypeOpen; 170 170 171 static size_t ph_generate_rfc5626_probe(int rid, const void *addr, int addrlen, void* buf, size_t bsize);171 static size_t ph_generate_rfc5626_probe(int rid, const void *addr, int addrlen, char* buf, size_t bsize); 172 172 static char * _get_local_sip_port(); 173 173 static void _get_local_video_sdp_port(char buf[]); … … 3728 3728 3729 3729 static size_t 3730 ph_generate_rfc5626_probe(int rid, const void *addr, int addrlen, void* buf, size_t bsize)3730 ph_generate_rfc5626_probe(int rid, const void *addr, int addrlen, char* buf, size_t bsize) 3731 3731 { 3732 3732 struct vline* vl = ph_find_vline_by_rid(rid); … … 7442 7442 h++; 7443 7443 } 7444 7444 7445 } 7445 7446 } … … 7458 7459 } 7459 7460 7461 #ifdef PHAPI_VIDEO_SUPPORT 7460 7462 static void previewVideoStreamRenderCallback(void *user_pointer, const MSPicture *local_view, const MSPicture *remote_view) 7461 7463 { … … 7466 7468 phcb->onFrameReady(-1,&info); 7467 7469 } 7470 #endif 7468 7471 7469 7472 PHAPI_EXPORT phStream* -
phapi/phms.c
r400 r407 197 197 video1->profile = make_profile(&av_profile, video1); 198 198 } 199 switch(video1->traffictype) 200 { 201 case PH_MSTREAM_TRAFFIC_IO: 202 ret = phms_video_stream_start(video, video1->profile, video1->remoteaddr,video1->remoteport,video1->remoteport+1,video1->ipayloads[0].number,video1->jitter, s); 203 break; 204 case PH_MSTREAM_TRAFFIC_OUT: 205 ret = phms_video_stream_start_send_only(video, video1->profile, video1->remoteaddr,video1->remoteport,video1->remoteport+1,video1->ipayloads[0].number,video1->jitter, s); 206 break; 207 case PH_MSTREAM_TRAFFIC_IN: 208 ret = phms_video_stream_start_receive_only(video, video1->profile, video1->remoteaddr,video1->remoteport,video1->remoteport+1,video1->ipayloads[0].number,video1->jitter, s); 209 break; 210 } 199 200 ret = phms_video_stream_start(video, video1->profile, video1->remoteaddr,video1->remoteport,video1->remoteport+1,video1->ipayloads[0].number,video1->jitter, s); 211 201 } 212 202 #endif -
phapi/phms.c
r406 r407 50 50 51 51 #include "phms_audiostream.h" 52 #ifdef PHAPI_VIDEO_SUPPORT 52 53 #include "phms_videostream.h" 54 #endif 53 55 54 56 #include "phdebug.h"
Note: See TracChangeset
for help on using the changeset viewer.
