forked from mirrors/linphone-iphone
Added --early-media option to call command
This commit is contained in:
parent
4c8545497e
commit
5a1c8cb9a9
1 changed files with 21 additions and 3 deletions
|
|
@ -7,6 +7,10 @@ CallCommand::CallCommand() :
|
|||
addExample(new DaemonCommandExample("call daemon-test@sip.linphone.org",
|
||||
"Status: Ok\n\n"
|
||||
"Id: 1"));
|
||||
addExample(new DaemonCommandExample("call daemon-test@sip.linphone.org --early-media",
|
||||
"Status: Ok\n\n"
|
||||
"Early media: Ok\n"
|
||||
"Id: 1"));
|
||||
addExample(new DaemonCommandExample("call daemon-test@sip.linphone.org",
|
||||
"Status: Error\n"
|
||||
"Reason: Call creation failed."));
|
||||
|
|
@ -14,12 +18,26 @@ CallCommand::CallCommand() :
|
|||
|
||||
void CallCommand::exec(Daemon *app, const char *args) {
|
||||
LinphoneCall *call;
|
||||
call = linphone_core_invite(app->getCore(), args);
|
||||
Response resp;
|
||||
ostringstream ostr;
|
||||
char address[256] = { 0 }, early_media[256] = { 0 };
|
||||
if (sscanf(args, "%s %s", address, early_media) == 2) {
|
||||
char *opt;
|
||||
LinphoneCallParams *cp;
|
||||
opt = strstr(early_media,"--early-media");
|
||||
cp = linphone_core_create_default_call_parameters(app->getCore());
|
||||
if (opt) {
|
||||
linphone_call_params_enable_early_media_sending(cp, TRUE);
|
||||
ostr << "Early media: Ok\n";
|
||||
}
|
||||
call = linphone_core_invite_with_params(app->getCore(), address, cp);
|
||||
} else {
|
||||
call = linphone_core_invite(app->getCore(), args);
|
||||
}
|
||||
|
||||
if (call == NULL) {
|
||||
app->sendResponse(Response("Call creation failed."));
|
||||
} else {
|
||||
Response resp;
|
||||
ostringstream ostr;
|
||||
ostr << "Id: " << app->updateCallId(call) << "\n";
|
||||
resp.setBody(ostr.str().c_str());
|
||||
app->sendResponse(resp);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue