summaryrefslogtreecommitdiff
path: root/src/libgsmd
diff options
context:
space:
mode:
authorerin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-12-19 09:34:34 +0000
committererin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-12-19 09:34:34 +0000
commit5f522a277d5ac93bae9d993cabc0f3e7b3dbb59e (patch)
treef4a1a4a61b01489242ad115921ecbbc1a09706c4 /src/libgsmd
parentcbbf4601211669ededac8d41d6adaec277af3e3b (diff)
gsmd: set and get Voicemail number (Erin Yueh)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3684 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/libgsmd')
-rw-r--r--src/libgsmd/libgsmd_network.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libgsmd/libgsmd_network.c b/src/libgsmd/libgsmd_network.c
index 333debd..5551de3 100644
--- a/src/libgsmd/libgsmd_network.c
+++ b/src/libgsmd/libgsmd_network.c
@@ -26,6 +26,7 @@
#include <libgsmd/libgsmd.h>
#include <libgsmd/misc.h>
+#include <libgsmd/sms.h>
#include <gsmd/usock.h>
#include <gsmd/event.h>
@@ -133,3 +134,36 @@ int lgsm_get_subscriber_num(struct lgsm_handle *lh)
{
return lgsm_send_simple(lh, GSMD_MSG_NETWORK, GSMD_NETWORK_GET_NUMBER);
}
+
+int lgsm_voicemail_set(struct lgsm_handle *lh, const char *number)
+{
+ struct gsmd_msg_hdr *gmh;
+ struct gsmd_voicemail *vmail;
+ int rc;
+
+ gmh = lgsm_gmh_fill(GSMD_MSG_NETWORK,
+ GSMD_NETWORK_VMAIL_SET, sizeof(*vmail));
+ if (!gmh)
+ return -ENOMEM;
+
+ vmail = (struct gsmd_voicemail *) gmh->data;
+ vmail->enable = 1;
+ if (lgsm_number2addr(&vmail->addr, number, 0)){
+ lgsm_gmh_free(gmh);
+ return -EINVAL;
+ }
+
+ if (lgsm_send(lh, gmh) < gmh->len + sizeof(*gmh)) {
+ lgsm_gmh_free(gmh);
+ return -EIO;
+ }
+
+ lgsm_gmh_free(gmh);
+ return 0;
+}
+
+/* Get currently configured voice mail number */
+int lgsm_voicemail_get(struct lgsm_handle *lh)
+{
+ return lgsm_send_simple(lh, GSMD_MSG_NETWORK, GSMD_NETWORK_VMAIL_GET);
+}
personal git repositories of Harald Welte. Your mileage may vary