From 5f522a277d5ac93bae9d993cabc0f3e7b3dbb59e Mon Sep 17 00:00:00 2001 From: erin_yueh Date: Wed, 19 Dec 2007 09:34:34 +0000 Subject: 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 --- src/libgsmd/libgsmd_network.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/libgsmd') 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 #include +#include #include #include @@ -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); +} -- cgit v1.2.3