summaryrefslogtreecommitdiff
path: root/src/libgsmd
diff options
context:
space:
mode:
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