Changeset 371:14c4ff75deb4 in verona
- Timestamp:
- Nov 17, 2011 4:40:56 PM (19 months ago)
- Branch:
- default
- Location:
- phapi
- Files:
-
- 2 edited
-
phapi.c (modified) (5 diffs)
-
sdphandler.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
phapi/phapi.c
r370 r371 2899 2899 2900 2900 2901 static char *ph_call_fix_media_dir(phcall_t *ca, const char *dir) 2902 { 2903 if (!ca->sdpctx) 2904 return 0; 2905 2906 if (ca->sdpctx->offer) { 2907 sdp_context_update_media_direction(ca->sdpctx, dir, 1); 2908 return ca->sdpctx->offerstr; 2909 } 2910 2911 if (ca->sdpctx->answer) { 2912 sdp_context_update_media_direction(ca->sdpctx, dir, 0); 2913 return ca->sdpctx->answerstr; 2914 } 2915 2916 return 0; 2917 2918 } 2919 2901 2920 PHAPI_EXPORT int 2902 2921 phResumeCall(int cid) … … 2905 2924 int i; 2906 2925 osip_message_t *reinvite; 2926 char *body; 2907 2927 2908 2928 if (!phIsInitialized) … … 2935 2955 osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO"); 2936 2956 2937 if (ca->sdpctx && ca->sdpctx->offerstr) 2938 { 2939 //FIXME must change the streams direction to a=sendrecv 2940 ph_req_set_body(reinvite, ca->sdpctx->offerstr, "application/sdp"); 2941 } 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 2942 2963 2943 2964 eXosip_lock(); … … 2954 2975 osip_message_t *reinvite; 2955 2976 int i; 2977 char *body; 2956 2978 2957 2979 DBG_SIP_NEGO("SIP_NEGO: phHoldCall\n"); … … 2979 3001 osip_message_set_subject(reinvite, "Call on hold"); 2980 3002 osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO"); 2981 if (ca->sdpctx && ca->sdpctx->offerstr)2982 {2983 //FIXME must change the streams direction to a=sendonly2984 ph_req_set_body(reinvite, ca->sdpctx->offerstr, "application/sdp");2985 }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"); 2986 3008 2987 3009 eXosip_lock(); -
phapi/sdphandler.c
r299 r371 704 704 osip_free(ctx); 705 705 } 706 707 708 void sdp_update_media_dir(sdp_message_t *sdp, const char *dir) { 709 710 int i = 0; 711 712 for(; !sdp_message_endof_media (sdp, i); i++) { 713 sdp_message_a_attribute_del(sdp, i, "inactive"); 714 sdp_message_a_attribute_del(sdp, i, "sendonly"); 715 sdp_message_a_attribute_del(sdp, i, "sendrecv"); 716 sdp_message_a_attribute_add(sdp, i, osip_strdup(dir), 0); 717 718 } 719 720 } 721 722 void sdp_context_update_media_direction(sdp_context_t *ctx, const char *dir, int offer) 723 { 724 725 if (offer) { 726 727 if (ctx->offerstr!=NULL) { 728 osip_free(ctx->offerstr); 729 ctx->offerstr = 0; 730 } 731 732 if (ctx->offer) { 733 sdp_update_media_dir(ctx->offer, dir); 734 } 735 sdp_message_to_str(ctx->offer, &ctx->offerstr); 736 return; 737 } 738 739 if (ctx->answerstr!=NULL) { 740 osip_free(ctx->answerstr); 741 ctx->answerstr = 0; 742 } 743 744 if (ctx->answer) { 745 sdp_update_media_dir(ctx->answer, dir); 746 } 747 sdp_message_to_str(ctx->answer, &ctx->answerstr); 748 749 750 }
Note: See TracChangeset
for help on using the changeset viewer.
