#include <unistd.h>#include <errno.h>#include <stdlib.h>#include "../../dprint.h"#include "../../ut.h"#include "../../config.h"#include "../../globals.h"#include "../../mem/mem.h"#include "../../mem/shm_mem.h"#include "../../parser/parse_uri.h"#include "../../parser/parse_content.h"#include "../../parser/parse_from.h"#include "../../data_lump_rpl.h"#include "../tm/t_hooks.h"#include "../tm/uac.h"#include "sms_funcs.h"#include "sms_report.h"#include "libsms_modem.h"#include "libsms_sms.h"

Go to the source code of this file.
Defines | |
| #define | CONTENT_TYPE_HDR "Content-Type: text/plain" |
| #define | CONTENT_TYPE_HDR_LEN (sizeof(CONTENT_TYPE_HDR)-1) |
| #define | ERR_MODEM_TEXT |
| #define | ERR_MODEM_TEXT_LEN (sizeof(ERR_MODEM_TEXT)-1) |
| #define | ERR_NUMBER_TEXT |
| #define | ERR_NUMBER_TEXT_LEN (sizeof(ERR_NUMBER_TEXT)-1) |
| #define | ERR_TRUNCATE_TEXT |
| #define | ERR_TRUNCATE_TEXT_LEN (sizeof(ERR_TRUNCATE_TEXT)-1) |
| #define | is_in_sip_addr(_p) |
| #define | no_sip_addr_begin(_p) |
| #define | OK_MSG |
| #define | OK_MSG_LEN (sizeof(OK_MSG)-1) |
| #define | STORED_NOTE |
| #define | STORED_NOTE_LEN (sizeof(STORED_NOTE)-1) |
Functions | |
| int | check_cds_report (struct modem *mdm, char *cds, int cds_len) |
| int | check_sms_report (struct incame_sms *sms) |
| void | modem_process (struct modem *mdm) |
| int | push_on_network (struct sip_msg *msg, int net) |
| int | send_as_sms (struct sms_msg *sms_messg, struct modem *mdm) |
| int | send_error (struct sms_msg *sms_messg, char *msg1_s, int msg1_len, char *msg2_s, int msg2_len) |
| int | send_sip_msg_request (str *to, str *from_user, str *body) |
| int | send_sms_as_sip (struct incame_sms *sms) |
| unsigned int | split_text (str *text, unsigned char *lens, int nice) |
Variables | |
| int | max_sms_parts |
| struct modem | modems [MAX_MODEMS] |
| int | net_pipes_in [MAX_NETWORKS] |
| struct network | networks [MAX_NETWORKS] |
| int | nr_of_modems |
| int | nr_of_networks |
| int * | queued_msgs |
| int | sms_report_type |
| struct tm_binds | tmb |
| int | use_contact |
| #define CONTENT_TYPE_HDR "Content-Type: text/plain" |
Definition at line 91 of file sms_funcs.c.
| #define CONTENT_TYPE_HDR_LEN (sizeof(CONTENT_TYPE_HDR)-1) |
Definition at line 92 of file sms_funcs.c.
| #define ERR_MODEM_TEXT |
Value:
"Due to our modem temporary indisponibility, "\ "the following message couldn't be sent : "
Definition at line 77 of file sms_funcs.c.
Referenced by send_as_sms().
| #define ERR_MODEM_TEXT_LEN (sizeof(ERR_MODEM_TEXT)-1) |
| #define ERR_NUMBER_TEXT |
Value:
" is an invalid number! Please resend your SMS "\ "using a number in +(country code)(area code)(local number) format. Thanks"\ " for using our service!"
Definition at line 67 of file sms_funcs.c.
Referenced by send_as_sms().
| #define ERR_NUMBER_TEXT_LEN (sizeof(ERR_NUMBER_TEXT)-1) |
| #define ERR_TRUNCATE_TEXT |
Value:
"We are sorry, but your message exceeded our "\ "maximum allowed length. The following part of the message wasn't sent"\ " : "
Definition at line 72 of file sms_funcs.c.
Referenced by send_as_sms().
| #define ERR_TRUNCATE_TEXT_LEN (sizeof(ERR_TRUNCATE_TEXT)-1) |
| #define is_in_sip_addr | ( | _p | ) |
Value:
((_p)!=' ' && (_p)!='\t' && (_p)!='(' && (_p)!='[' && (_p)!='<' \ && (_p)!='>' && (_p)!=']' && (_p)!=')' && (_p)!='?' && (_p)!='!' \ && (_p)!=';' && (_p)!=',' && (_p)!='\n' && (_p)!='\r' && (_p)!='=')
Definition at line 94 of file sms_funcs.c.
Referenced by send_sms_as_sip().
| #define no_sip_addr_begin | ( | _p | ) |
Value:
( (_p)!=' ' && (_p)!='\t' && (_p)!='-' && (_p)!='=' && (_p)!='\r'\ && (_p)!='\n' && (_p)!=';' && (_p)!=',' && (_p)!='.' && (_p)!=':')
Definition at line 99 of file sms_funcs.c.
Referenced by send_sms_as_sip().
| #define OK_MSG |
Value:
"Your SMS was finally successfully delivered!"\ " Your message was: "
Definition at line 87 of file sms_funcs.c.
Referenced by check_sms_report().
| #define OK_MSG_LEN (sizeof(OK_MSG)-1) |
| #define STORED_NOTE |
Value:
"NOTE: Your SMS received provisional confirmation"\ " 48 \"Delivery is not yet possible\". The SMS was store on the "\ "SMSCenter for further delivery. Our gateway cannot guarantee "\ "further information regarding your SMS delivery! Your message was: "
Definition at line 81 of file sms_funcs.c.
Referenced by check_sms_report().
| #define STORED_NOTE_LEN (sizeof(STORED_NOTE)-1) |
| int check_cds_report | ( | struct modem * | mdm, | |
| char * | cds, | |||
| int | cds_len | |||
| ) |
Definition at line 659 of file sms_funcs.c.
References cds2sms(), and check_sms_report().
Referenced by modem_process().
| int check_sms_report | ( | struct incame_sms * | sms | ) |
Definition at line 621 of file sms_funcs.c.
References incame_sms::ascii, get_error_str(), get_sms_from_report_queue(), get_text_from_report_queue(), _str::len, LM_DBG, OK_MSG, OK_MSG_LEN, relay_report_to_queue(), remove_sms_from_report_queue(), _str::s, send_error(), incame_sms::sender, incame_sms::sms_id, STORED_NOTE, and STORED_NOTE_LEN.
Referenced by check_cds_report(), and modem_process().
| void modem_process | ( | struct modem * | mdm | ) |
Definition at line 672 of file sms_funcs.c.
References incame_sms::ascii, check_cds_report(), check_memory(), check_sms_report(), check_timeout_in_report_queue(), counter, incame_sms::date, DATE_LEN, modem::device, getsms(), initmodem(), incame_sms::is_statusreport, _str::len, len, LM_DBG, LM_ERR, LM_WARN, modem::looping_interval, MAX_MEM, network::max_sms_per_call, incame_sms::name, network::name, modem::name, modem::net_list, networks, NO_REPORT, nr_of_networks, openmodem(), network::pipe_out, _str::s, send_as_sms(), send_sms_as_sip(), incame_sms::sender, set_gettime_function(), setmodemparams(), sms_report_type, sms_msg::text, incame_sms::time, TIME_LEN, sms_msg::to, USED_MEM, and incame_sms::userdatalength.
Referenced by sms_process().
| int push_on_network | ( | struct sip_msg * | msg, | |
| int | net | |||
| ) |
Definition at line 105 of file sms_funcs.c.
References append_str, sip_msg::content_length, to_body::error, sip_msg::first_line, sms_msg::from, sip_msg::from, get_body(), get_content_length, get_to, HDR_TO_F, _str::len, len, LM_DBG, LM_ERR, MAX_QUEUED_MESSAGES, net_pipes_in, sip_msg::new_uri, parse_content_type_hdr(), parse_from_header(), parse_headers(), parse_uri(), hdr_field::parsed, queued_msgs, msg_start::request, _str::s, shm_free, shm_malloc(), SMS_FOOTER, SMS_FOOTER_LEN, SMS_HDR_AF_ADDR, SMS_HDR_AF_ADDR_LEN, SMS_HDR_BF_ADDR, SMS_HDR_BF_ADDR_LEN, SUBTYPE_CPIM, SUBTYPE_PLAIN, sms_msg::text, sms_msg::to, sip_msg::to, TYPE_MESSAGE, TYPE_TEXT, msg_start::u, to_body::uri, and sip_uri::user.
Referenced by w_sms_send_msg(), and w_sms_send_msg_to_net().
Definition at line 380 of file sms_funcs.c.
References add_sms_into_report_queue(), append_str, buf, buf_len, ERR_MODEM_TEXT, ERR_MODEM_TEXT_LEN, ERR_NUMBER_TEXT, ERR_NUMBER_TEXT_LEN, ERR_TRUNCATE_TEXT, ERR_TRUNCATE_TEXT_LEN, sms_msg::from, _str::len, LM_DBG, MAX_SMS_LENGTH, max_sms_parts, NO_REPORT, putsms(), sms_msg::ref, _str::s, send_error(), shm_free, SMS_EDGE_PART, SMS_EDGE_PART_LEN, SMS_FOOTER, SMS_FOOTER_LEN, SMS_HDR_AF_ADDR_LEN, SMS_HDR_BF_ADDR_LEN, sms_report_type, SMS_TRUNCATED, SMS_TRUNCATED_LEN, split_text(), sms_msg::text, and sms_msg::to.
Referenced by modem_process().
| int send_error | ( | struct sms_msg * | sms_messg, | |
| char * | msg1_s, | |||
| int | msg1_len, | |||
| char * | msg2_s, | |||
| int | msg2_len | |||
| ) | [inline] |
Definition at line 311 of file sms_funcs.c.
References append_str, sms_msg::from, _str::len, LM_ERR, pkg_free, pkg_malloc, _str::s, send_sip_msg_request(), and sms_msg::to.
Referenced by check_sms_report(), and send_as_sms().
Definition at line 243 of file sms_funcs.c.
References append_str, CONTENT_TYPE_HDR, CONTENT_TYPE_HDR_LEN, CRLF, CRLF_LEN, domain, sms_msg::from, _str::len, LM_ERR, msg_type, pkg_free, pkg_malloc, _str::s, tm_binds::t_request, tmb, and use_contact.
Referenced by send_error(), and send_sms_as_sip().
| int send_sms_as_sip | ( | struct incame_sms * | sms | ) |
Definition at line 479 of file sms_funcs.c.
References append_str, incame_sms::ascii, CRLF, CRLF_LEN, incame_sms::date, DATE_LEN, is_in_sip_addr, _str::len, LM_DBG, LM_ERR, LM_WARN, no_sip_addr_begin, _str::s, send_sip_msg_request(), incame_sms::sender, SMS_HDR_AF_ADDR, SMS_HDR_AF_ADDR_LEN, SMS_HDR_BF_ADDR, SMS_HDR_BF_ADDR_LEN, incame_sms::time, TIME_LEN, and incame_sms::userdatalength.
Referenced by modem_process().
| unsigned int split_text | ( | str * | text, | |
| unsigned char * | lens, | |||
| int | nice | |||
| ) | [inline] |
Definition at line 339 of file sms_funcs.c.
References _str::len, len, MAX_SMS_LENGTH, _str::s, SMS_EDGE_PART_LEN, and SMS_FOOTER_LEN.
Referenced by send_as_sms().
| int max_sms_parts |
Definition at line 60 of file sms_funcs.c.
| int net_pipes_in[MAX_NETWORKS] |
Definition at line 56 of file sms_funcs.c.
Referenced by fixup_sms_send_msg_to_net(), global_init(), modem_process(), and parse_config_lines().
| int nr_of_modems |
| int nr_of_networks |
Definition at line 58 of file sms_funcs.c.
Referenced by fixup_sms_send_msg_to_net(), global_init(), modem_process(), and parse_config_lines().
| int* queued_msgs |
Definition at line 61 of file sms_funcs.c.
| int sms_report_type |
Definition at line 63 of file sms_funcs.c.
TM bind
Definition at line 64 of file sms_funcs.c.
| int use_contact |
Definition at line 62 of file sms_funcs.c.
1.5.6