From e1400931ff5ff3db98cbf704476dfaeeb2e754f3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 15 Jan 2013 13:08:24 +0100 Subject: [PATCH] add missing fiels --- daemon/commands/contact.cc | 23 +++++++++++++++++++++++ daemon/commands/contact.h | 12 ++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 daemon/commands/contact.cc create mode 100644 daemon/commands/contact.h diff --git a/daemon/commands/contact.cc b/daemon/commands/contact.cc new file mode 100644 index 000000000..3f0ef52f3 --- /dev/null +++ b/daemon/commands/contact.cc @@ -0,0 +1,23 @@ +#include "contact.h" + +using namespace std; + +ContactCommand::ContactCommand() : + DaemonCommand("contact", "contact ", "Set a contact name.") { + addExample(new DaemonCommandExample("contact sip:root@unknown-host", + "Status: Ok\n\n")); +} +void ContactCommand::exec(Daemon *app, const char *args) { + LinphoneCore *lc = app->getCore(); + char *contact; + char username[256] = { 0 }; + char hostname[256] = { 0 }; + if (sscanf(args, "%255s %255s", username, hostname) >= 1) { + contact=ortp_strdup_printf("sip:%s@%s",username,hostname); + linphone_core_set_primary_contact(lc,contact); + ms_free(contact); + app->sendResponse(Response("", Response::Ok)); + } else { + app->sendResponse(Response("Missing/Incorrect parameter(s).")); + } +} diff --git a/daemon/commands/contact.h b/daemon/commands/contact.h new file mode 100644 index 000000000..34879ae48 --- /dev/null +++ b/daemon/commands/contact.h @@ -0,0 +1,12 @@ +#ifndef COMMAND_CONTACT_H_ +#define COMMAND_CONTACT_H_ + +#include "../daemon.h" + +class ContactCommand: public DaemonCommand { +public: + ContactCommand(); + virtual void exec(Daemon *app, const char *args); +}; + +#endif //COMMAND_CONTACT_H_