/* * Send a message to the bearerbox for delivery to a phone. * Return >= 0 for success & count of splitted sms messages, * -1 for failure. Does not destroy the msg. */ static int send_message(Msg *msg) { unsigned long msg_count; List *list; gw_assert(msg != NULL); gw_assert(msg_type(msg) == sms); /* * Encode our smsbox-id to the msg structure. * This will allow bearerbox to return specific answers to the * same smsbox, mainly for DLRs and SMS proxy modes. */ if (smsbox_id != NULL) { msg->sms.boxc_id = octstr_duplicate(smsbox_id); } list = sms_split(msg, NULL, NULL, NULL, NULL, 1, 0, 100, MAX_SMS_OCTETS); msg_count = gwlist_len(list); gwlist_destroy(list, msg_destroy_item); debug("sms", 0, "message length %ld, sending %ld messages", octstr_len(msg->sms.msgdata), msg_count); if (delay > 0) gwthread_sleep(delay); /* pass message to bearerbox */ if (deliver_to_bearerbox(msg) != 0) return -1; return msg_count; }
/* * Send a message to the bearerbox for delivery to a phone. * Return >= 0 for success & count of splitted sms messages, * -1 for failure. Does not destroy the msg. */ static int send_message(Msg *msg) { unsigned long msg_count; List *list; gw_assert(msg != NULL); gw_assert(msg_type(msg) == sms); /* * Encode our smsbox-id to the msg structure. * This will allow bearerbox to return specific answers to the * same smsbox, mainly for DLRs and SMS proxy modes. * * In addition the -x flag can be used to identify the mtbatch * instance with an own smsbox-id, but let the normal smsbox * daemons handle the DLRs coming back, as the mtbatch shuts down * after all MTs have been injected. It's not meant to process * the DLR messages. */ if (no_smsbox_id == 0 && smsbox_id != NULL) { msg->sms.boxc_id = octstr_duplicate(smsbox_id); } list = sms_split(msg, NULL, NULL, NULL, NULL, 1, 0, 100, MAX_SMS_OCTETS); msg_count = gwlist_len(list); gwlist_destroy(list, msg_destroy_item); debug("sms", 0, "message length %ld, sending %ld messages", octstr_len(msg->sms.msgdata), msg_count); if (delay > 0) gwthread_sleep(delay); /* pass message to bearerbox */ if (deliver_to_bearerbox(msg) != 0) return -1; return msg_count; }