Media/WebRTC/SIPCCMessaging: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| (14 intermediate revisions by 2 users not shown) | |||
| Line 3: | Line 3: | ||
SIPCC uses a bunch of message queues so it can be complicated to figure out how to add a new subroutine call at the CC API layer and have it make it all the way to the GSM layer. The following is just a checklist of the things you will have to change. | SIPCC uses a bunch of message queues so it can be complicated to figure out how to add a new subroutine call at the CC API layer and have it make it all the way to the GSM layer. The following is just a checklist of the things you will have to change. | ||
* Add the new API to the abstract <code>CC_Call</code> interface in <code>media/webrtc/signaling/include/CC_Call.h</code>. | * Add the new API to the abstract <code>CC_Call</code> interface in: <code>media/webrtc/signaling/include/CC_Call.h</code>. | ||
virtual void setPeerConnection(const std::string& handle) = 0; | virtual void setPeerConnection(const std::string& handle) = 0; | ||
* Add the new API to the the concrete <code>CC_SIPCall</code> implementation in: <code>media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h</code>: | |||
* Add the new API to the the concrete <code>CC_SIPCall</code> implementation in <code>media/webrtc/signaling/src/softphonewrapper.h</code>: | |||
virtual void setPeerConnection(const std::string& handle); | virtual void setPeerConnection(const std::string& handle); | ||
* And <code>media/webrtc/signaling/src/softphonewrapper.cpp</code>. Note that this is just calling a wrapper and this is where the C++/C transition takes place: | * And <code>media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp</code>. Note that this is just calling a wrapper and this is where the C++/C transition takes place: | ||
void CC_SIPCCCall::setPeerConnection(const std::string& handle) | |||
{ | { | ||
CSFLogDebug(logTag, "setPeerConnection"); | CSFLogDebug(logTag, "setPeerConnection"); | ||
peerconnection = handle; | |||
CCAPI_SetPeerConnection(callHandle, handle.c_str()); | CCAPI_SetPeerConnection(callHandle, handle.c_str()); | ||
} | } | ||
* Add the new <code>CCAPI_*</code> wrapper to: <code>media/webrtc/signaling/src/sipcc/include/ccapi_call.h</code> | |||
* Add the new <code>CCAPI_*</code> wrapper to <code>media/webrtc/signaling/src/sipcc/include/ccapi_call.h</code> | |||
cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc); | cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc); | ||
* The implementation goes in: <code>media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c</code>. In this case this is a wrapper around a feature set: | |||
* The implementation goes in <code>media/webrtc/signaling/src/sipcc/core/ccapp/ | |||
cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc) { | cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc) { | ||
| Line 32: | Line 29: | ||
} | } | ||
* We need a new feature name. Set it up in: <code>media/webrtc/signaling/src/sipcc/core/includes/ccapi.h</code> in <code>group_cc_feature_t</code>. | |||
CC_FEATURE_SETPEERCONNECTION | |||
* Also add it to the list in: <code>media/webrtc/signaling/src/sipcc/core/includes/ccapi.h</code> in <code>cc_feature_names[]</code> | |||
"SETPEERCONNECTION", | |||
* | * In the same file add in <code>cc_msg_t</code> | ||
cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t *pc) { | CC_MSG_SETPEERCONNECTION, | ||
* and in <code>cc_msg_names</code> | |||
"SETPEERCONNECTION", | |||
* Implement the feature send which is a wrapper around a CPR send. The declaration goes in: <code>media/webrtc/signaling/src/sipcc/include/cc_call_feature.h</code> | |||
cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc); | |||
* The implementation goes in <code>media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c</code>. Note that we have defined a CC_FEATURE_SETPEERCONNECTION. The net effect of this is to send a msg across the message queue. | |||
cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc) { | |||
cc_media_constraints_t *constraints = NULL; | |||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle), | |||
GET_LINE_ID(call_handle), __FUNCTION__)); | |||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETPEERCONNECTION, JSEP_NO_ACTION, | |||
0, 0, NO_STREAM, 0, constraints, pc, NULL); | |||
} | } | ||
* We | * On the other end of the message queue (in ccapp), we need to handle the event. We add new code to: <code>media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c</code> in <code>processSessionEvent</code>: | ||
case CC_FEATURE_SETPEERCONNECTION: | |||
PR_ASSERT(strlen(data) < PC_HANDLE_SIZE); | |||
if (strlen(data) >= PC_HANDLE_SIZE) | |||
return; | |||
sstrncpy(featdata.pc.pc_handle, data, sizeof(featdata.pc.pc_handle)); | |||
cc_int_feature2(CC_MSG_SETPEERCONNECTION, CC_SRC_UI, CC_SRC_GSM, | |||
call_id, (line_t)instance, | |||
CC_FEATURE_SETPEERCONNECTION, &featdata); | |||
break; | |||
| Line 62: | Line 82: | ||
File: <code>media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp</code> | |||
int CC_SIPCCCall::createOffer (MediaTrackTable* tracks, const std::string& hints) { | |||
return CCAPI_CreateOffer(callHandle, tracks, 16384, 1024); | |||
} | |||
File: | File: <code>media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c</code> | ||
src/sipcc/core/ccapp/ccapi_call.c | |||
cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, MediaTrackTable* tracks, int audioPort, int videoPort) | cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, MediaTrackTable* tracks, int audioPort, int videoPort) | ||
src/sipcc/core/ccapp/cc_call_feature.c | File: <code>media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c</code> | ||
cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref) | cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref) | ||
src/sipcc/core/ccapp/cc_call_feature.c | File: <code>media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c</code> | ||
cc_return_t cc_invokeFeature(cc_call_handle_t call_handle, group_cc_feature_t featureId, cc_sdp_direction_t video_pref, cc_jsep_action_t action, string_t data) | cc_return_t cc_invokeFeature(cc_call_handle_t call_handle, group_cc_feature_t featureId, cc_sdp_direction_t video_pref, cc_jsep_action_t action, string_t data) | ||
Latest revision as of 16:25, 23 February 2013
Notes on how to add a new message to SIPCC
SIPCC uses a bunch of message queues so it can be complicated to figure out how to add a new subroutine call at the CC API layer and have it make it all the way to the GSM layer. The following is just a checklist of the things you will have to change.
- Add the new API to the abstract
CC_Callinterface in:media/webrtc/signaling/include/CC_Call.h.
virtual void setPeerConnection(const std::string& handle) = 0;
- Add the new API to the the concrete
CC_SIPCallimplementation in:media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h:
virtual void setPeerConnection(const std::string& handle);
- And
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp. Note that this is just calling a wrapper and this is where the C++/C transition takes place:
void CC_SIPCCCall::setPeerConnection(const std::string& handle)
{
CSFLogDebug(logTag, "setPeerConnection");
peerconnection = handle;
CCAPI_SetPeerConnection(callHandle, handle.c_str());
}
- Add the new
CCAPI_*wrapper to:media/webrtc/signaling/src/sipcc/include/ccapi_call.h
cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc);
- The implementation goes in:
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c. In this case this is a wrapper around a feature set:
cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc) {
return CC_CallFeature_SetPeerConnection(handle, pc);
}
- We need a new feature name. Set it up in:
media/webrtc/signaling/src/sipcc/core/includes/ccapi.hingroup_cc_feature_t.
CC_FEATURE_SETPEERCONNECTION
- Also add it to the list in:
media/webrtc/signaling/src/sipcc/core/includes/ccapi.hincc_feature_names[]
"SETPEERCONNECTION",
- In the same file add in
cc_msg_t
CC_MSG_SETPEERCONNECTION,
- and in
cc_msg_names
"SETPEERCONNECTION",
- Implement the feature send which is a wrapper around a CPR send. The declaration goes in:
media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc);
- The implementation goes in
media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c. Note that we have defined a CC_FEATURE_SETPEERCONNECTION. The net effect of this is to send a msg across the message queue.
cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc) {
cc_media_constraints_t *constraints = NULL;
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
GET_LINE_ID(call_handle), __FUNCTION__));
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETPEERCONNECTION, JSEP_NO_ACTION,
0, 0, NO_STREAM, 0, constraints, pc, NULL);
}
- On the other end of the message queue (in ccapp), we need to handle the event. We add new code to:
media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.cinprocessSessionEvent:
case CC_FEATURE_SETPEERCONNECTION:
PR_ASSERT(strlen(data) < PC_HANDLE_SIZE);
if (strlen(data) >= PC_HANDLE_SIZE)
return;
sstrncpy(featdata.pc.pc_handle, data, sizeof(featdata.pc.pc_handle));
cc_int_feature2(CC_MSG_SETPEERCONNECTION, CC_SRC_UI, CC_SRC_GSM,
call_id, (line_t)instance,
CC_FEATURE_SETPEERCONNECTION, &featdata);
break;
File: media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
int CC_SIPCCCall::createOffer (MediaTrackTable* tracks, const std::string& hints) {
return CCAPI_CreateOffer(callHandle, tracks, 16384, 1024);
}
File: media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c
cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, MediaTrackTable* tracks, int audioPort, int videoPort)
File: media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref)
File: media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
cc_return_t cc_invokeFeature(cc_call_handle_t call_handle, group_cc_feature_t featureId, cc_sdp_direction_t video_pref, cc_jsep_action_t action, string_t data)
ccappTaskPostMsg ====> ccapp message queue src/sipcc/core/ccapp/ccprovider.c processSessionEvent (line_t line_id, callid_t call_id, unsigned int event, sdp_direction_e video_pref, ccSession_feature_t ccData) src/sipcc/core/gsm/ccapi.c void cc_createoffer (cc_srcs_t src_id, cc_srcs_t dst_id, callid_t call_id, line_t line, cc_features_t feature_id, cc_feature_data_t *data) cc_send_msg ====> gsm message queue src/sipcc/core/gsm/fim.c boolean fim_process_event (void *data, boolean cac_passed) src/sipcc/core/gsm/fsmdef.c static sm_rcs_t fsmdef_ev_createoffer (sm_event_t *event)