+/* MGCP rtp stream modes */
+#define MGCP_CX_SENDONLY 0
+#define MGCP_CX_RECVONLY 1
+#define MGCP_CX_SENDRECV 2
+#define MGCP_CX_CONF 3
+#define MGCP_CX_MUTE 4
+#define MGCP_CX_INACTIVE 4
+
+static char *mgcp_cxmodes[] = {
+ "sendonly",
+ "recvonly",
+ "sendrecv",
+ "confrnce",
+ "inactive"
+};
+
+static char context[AST_MAX_EXTENSION] = "default";
+
+static char language[MAX_LANGUAGE] = "";
+static char musicclass[MAX_LANGUAGE] = "";
+static char callerid[AST_MAX_EXTENSION] = "";
+
+static int inbanddtmf = 0;
+static int nat = 0;
+
+static int use_callerid = 1;
+
+static int cur_signalling = -1;
+
+static unsigned int cur_group = 0;
+static unsigned int cur_callergroup = 0;
+static unsigned int cur_pickupgroup = 0;
+
+static int relaxdtmf = 0;
+
+static int immediate = 0;
+
+static int stripmsd = 0;
+
+static int callwaiting = 0;
+
+static int callwaitingcallerid = 0;
+
+static int hidecallerid = 0;
+
+static int callreturn = 0;
+
+static int threewaycalling = 0;
+
+static int transfer = 0;
+
+static int cancallforward = 0;
+
+static int busycount = 3;
+
+static int callprogress = 0;
+
+static char accountcode[20] = "";
+
+static char mailbox[AST_MAX_EXTENSION];
+
+static int amaflags = 0;
+
+static int adsi = 0;
+
+
static int usecnt =0;
static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
static int oseq;
+/* Wait up to 16 seconds for first digit (FXO logic) */
+static int firstdigittimeout = 16000;
+
+/* How long to wait for following digits (FXO logic) */
+static int gendigittimeout = 8000;
+
+/* How long to wait for an extra digit, if there is an ambiguous match */
+static int matchdigittimeout = 3000;
+
/* Protect the monitoring thread, so only one process can kill or start it, and not
when it's doing something critical. */
static pthread_mutex_t netlock = AST_MUTEX_INITIALIZER;
@@ -120,6 +200,10 @@
#define TYPE_TRUNK 1
#define TYPE_LINE 2
+#define MGCP_ONHOOK 1
+#define MGCP_OFFHOOK 2
+
+
struct mgcp_endpoint {
pthread_mutex_t lock;
char name[80];
@@ -127,12 +211,24 @@
char exten[AST_MAX_EXTENSION]; /* Extention where to start */
char context[AST_MAX_EXTENSION];
char language[MAX_LANGUAGE];
- char callerid[256]; /* Caller*ID */
+ char callerid[AST_MAX_EXTENSION]; /* Caller*ID */
+ char lastcallerid[AST_MAX_EXTENSION]; /* Last Caller*ID */
+ char callwaitcid[AST_MAX_EXTENSION];
+ char call_forward[AST_MAX_EXTENSION]; /* Last Caller*ID */
+ char mailbox[AST_MAX_EXTENSION];
+ char musicclass[MAX_LANGUAGE];
char curtone[80]; /* Current tone */
char txident[80];
char cxident[80];
char callid[80];
+ unsigned int callgroup;
+ unsigned int pickupgroup;
+ int callwaiting;
+ int cancallforward;
+ int callreturn;
+ int dnd;
int hascallerid;
+ int hidecallerid;
int dtmfinband;
int amaflags;
int type;
@@ -145,7 +241,11 @@
int capability;
int nonCodecCapability;
int outgoing;
- struct ast_dsp *vad;
+ int onhooktime;
+ int msgstate;
+ int immediate;
+ int hookstate;
+ struct ast_dsp *dsp;
struct ast_channel *owner;
struct ast_rtp *rtp;
struct sockaddr_in tmpdest;
@@ -176,10 +276,16 @@
static struct ast_frame *mgcp_read(struct ast_channel *ast);
static int transmit_response(struct mgcp_endpoint *p, char *msg, struct mgcp_request *req, char *msgrest);
-static int transmit_notify_request(struct mgcp_endpoint *p, char *tone, int offhook);
+static int transmit_notify_request(struct mgcp_endpoint *p, char *tone);
+static int transmit_notify_request_with_callerid(struct mgcp_endpoint *p, char *tone, char *callerid);
static int transmit_connection_del(struct mgcp_endpoint *p);
-static int transmit_notify_request_with_callerid(struct mgcp_endpoint *p, char *tone, int offhook, char *callerid);
static int transmit_audit_endpoint(struct mgcp_endpoint *p);
+static void start_rtp(struct mgcp_endpoint *p);
+
+static int has_voicemail(struct mgcp_endpoint *p)
+{
+ return ast_app_has_voicemail(p->mailbox);
+}
Also fixes the callerid not displaying on dg-10[24]s
Uses stutter dialtone to indicate message waiting, also uses vmwi if the
firmware on the box supports it. (I have one that does and one that
doesn't)
In the works, callwaiting and threeway.
--Karl
Karl there is a little problem
all incomming calls routed to MGCP phone (aaln/1@MGCP), the phone is
ringing but rtp is already established and remote caller can here me
before I will answer :)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum