sms_funcs.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 
00029 #ifndef _SMS_FUNCS_H
00030 #define  _SMS_FUNCS_H
00031 
00032 #include "../../parser/msg_parser.h"
00033 #include "../../str.h"
00034 #include <termios.h>
00035 #include "../../modules/tm/tm_load.h"
00036 
00037 
00038 #define MAX_MODEMS    5       /* max number of modems */
00039 #define MAX_NETWORKS  5       /* max number of networks */
00040 
00041 #define MAX_CHAR_BUF 128        /* max length of character buffer */
00042 #define MAX_CONFIG_PARAM 1024   /* max length of a config parameter */
00043 #define MAX_SMS_LENGTH   160
00044 #define MAX_SMS_PARTS    4      /* maximum number of parts for a sms */
00045 #define MAX_QUEUED_MESSAGES 100 /* maximum nr of messages waiting to send */
00046 
00047 #define SMS_HDR_BF_ADDR      "From "
00048 #define SMS_HDR_BF_ADDR_LEN  (sizeof(SMS_HDR_BF_ADDR)-1)
00049 #define SMS_HDR_AF_ADDR      " (if you reply DO NOT remove it)\r\n\r\n"
00050 #define SMS_HDR_AF_ADDR_LEN  (sizeof(SMS_HDR_AF_ADDR)-1)
00051 #define SMS_FOOTER           "\r\n\r\n[SIP-ROUTER.ORG]"
00052 #define SMS_FOOTER_LEN       (sizeof(SMS_FOOTER)-1)
00053 #define SMS_EDGE_PART        "( / )"
00054 #define SMS_EDGE_PART_LEN    (sizeof(SMS_EDGE_PART)-1)
00055 #define SMS_TRUNCATED        "(truncated)"
00056 #define SMS_TRUNCATED_LEN    (sizeof(SMS_TRUNCATED)-1)
00057 
00058 #define TIME_LEN   8          /* xx-xx-xx */
00059 #define DATE_LEN   TIME_LEN
00060 
00061 #define NO_REPORT  0
00062 #define SMS_REPORT 1
00063 #define CDS_REPORT 2
00064 
00065 #define SMS_BODY_SCAN_NO        0
00066 #define SMS_BODY_SCAN           1
00067 #define SMS_BODY_SCAN_MIX       2
00068 
00069 struct network {
00070         char name[MAX_CHAR_BUF+1];
00071         int  max_sms_per_call;
00072         int  pipe_out;
00073 };
00074 
00075 struct modem {
00076         char name[MAX_CHAR_BUF+1];
00077         char device[MAX_CHAR_BUF+1];
00078         char pin[MAX_CHAR_BUF+1];
00079         char smsc[MAX_CHAR_BUF+1];
00080         int  net_list[MAX_NETWORKS];
00081         struct termios oldtio;
00082         int  mode;
00083         int  retry;
00084         int  looping_interval;
00085         int  fd;
00086         int  baudrate;
00087         int  scan;
00088         char to[MAX_CHAR_BUF+1];
00089 };
00090 
00091 struct sms_msg {
00092         str  text;
00093         str  to;
00094         str  from;
00095         int  ref;
00096 };
00097 
00098 struct incame_sms {
00099         char sender[31];
00100         char name[64];
00101         char date[DATE_LEN];
00102         char time[TIME_LEN];
00103         char ascii[500];
00104         char smsc[31];
00105         int  userdatalength;
00106         int  is_statusreport;
00107         int  sms_id;
00108 };
00109 
00110 
00111 extern struct modem modems[MAX_MODEMS];
00112 extern struct network networks[MAX_NETWORKS];
00113 extern int    net_pipes_in[MAX_NETWORKS];
00114 extern int    nr_of_networks;
00115 extern int    nr_of_modems;
00116 extern int    max_sms_parts;
00117 extern str    domain;
00118 extern int    *queued_msgs;
00119 extern int    use_contact;
00120 extern int    sms_report_type;
00121 extern struct tm_binds tmb;
00122 
00123 void modem_process(struct modem*);
00124 int  push_on_network(struct sip_msg*, int);
00125 
00126 
00127 #endif
00128