diff options
Diffstat (limited to 'src/libgsmd')
-rw-r--r-- | src/libgsmd/libgsmd_voicecall.c | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/libgsmd/libgsmd_voicecall.c b/src/libgsmd/libgsmd_voicecall.c index 8804cce..c40ea51 100644 --- a/src/libgsmd/libgsmd_voicecall.c +++ b/src/libgsmd/libgsmd_voicecall.c @@ -125,3 +125,126 @@ int lgsm_voice_ctrl(struct lgsm_handle *lh, const struct lgsm_voicecall_ctrl *ct return 0; } + +int lgsm_voice_fwd_disable(struct lgsm_handle *lh, + enum lgsmd_voicecall_fwd_reason reason) +{ + struct gsmd_msg_hdr *gmh; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_DIS, sizeof(int)); + if (!gmh) + return -ENOMEM; + + *(int *) gmh->data = reason; + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} + +int lgsm_voice_fwd_enable(struct lgsm_handle *lh, + enum lgsmd_voicecall_fwd_reason reason) +{ + struct gsmd_msg_hdr *gmh; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_EN, sizeof(int)); + if (!gmh) + return -ENOMEM; + + *(int *) gmh->data = reason; + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} + +int lgsm_voice_fwd_stat(struct lgsm_handle *lh, + enum lgsmd_voicecall_fwd_reason reason) +{ + struct gsmd_msg_hdr *gmh; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_STAT, sizeof(int)); + if (!gmh) + return -ENOMEM; + + *(int *) gmh->data = reason; + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} + +int lgsm_voice_fwd_reg(struct lgsm_handle *lh, + struct lgsm_voicecall_fwd_reg *fwd_reg) +{ + struct gsmd_msg_hdr *gmh; + struct gsmd_call_fwd_reg *gcfr; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_REG, sizeof(struct gsmd_call_fwd_reg)); + if (!gmh) + return -ENOMEM; + + gcfr = (struct gsmd_call_fwd_reg *)gmh->data; + gcfr->reason = fwd_reg->reason; + strcpy(gcfr->addr.number, fwd_reg->number.addr); + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} + +int lgsm_voice_fwd_erase(struct lgsm_handle *lh, + enum lgsmd_voicecall_fwd_reason reason) +{ + struct gsmd_msg_hdr *gmh; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_ERAS, sizeof(int)); + if (!gmh) + return -ENOMEM; + + *(int *) gmh->data = reason; + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} |