summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--action.cpp8
-rw-r--r--apppbx.cpp15
-rw-r--r--joinpbx.cpp27
-rw-r--r--joinpbx.h2
-rw-r--r--message.h1
-rw-r--r--route.c5
-rw-r--r--route.h9
-rw-r--r--todo.txt5
8 files changed, 58 insertions, 14 deletions
diff --git a/action.cpp b/action.cpp
index 8056435..4b3f383 100644
--- a/action.cpp
+++ b/action.cpp
@@ -546,7 +546,7 @@ void EndpointAppPBX::action_init_partyline(void)
struct port_list *portlist = ea_endpoint->ep_portlist;
struct message *message;
struct route_param *rparam;
- int partyline;
+ int partyline, jingle = 0;
struct join_relation *relation;
portlist = ea_endpoint->ep_portlist;
@@ -571,6 +571,8 @@ void EndpointAppPBX::action_init_partyline(void)
goto noroom;
}
partyline = rparam->integer_value;
+ if ((rparam = routeparam(e_action, PARAM_JINGLE)))
+ jingle = 1;
/* don't create join if partyline exists */
join = join_first;
@@ -579,7 +581,7 @@ void EndpointAppPBX::action_init_partyline(void)
if (join->j_type == JOIN_TYPE_PBX)
{
joinpbx = (class JoinPBX *)join;
- if (joinpbx->j_partyline == rparam->integer_value)
+ if (joinpbx->j_partyline == partyline)
break;
}
join = join->next;
@@ -614,9 +616,11 @@ void EndpointAppPBX::action_init_partyline(void)
/* send setup to join */
trace_header("ACTION partyline (calling)", DIRECTION_NONE);
add_trace("room", NULL, "%d", partyline);
+ add_trace("jingle", NULL, (jingle)?"on":"off");
end_trace();
message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_join_id, EPOINT_TO_JOIN, MESSAGE_SETUP);
message->param.setup.partyline = partyline;
+ message->param.setup.partyline_jingle = jingle;
memcpy(&message->param.setup.dialinginfo, &e_dialinginfo, sizeof(struct dialing_info));
memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
memcpy(&message->param.setup.callerinfo, &e_callerinfo, sizeof(struct caller_info));
diff --git a/apppbx.cpp b/apppbx.cpp
index 375980a..1262ef6 100644
--- a/apppbx.cpp
+++ b/apppbx.cpp
@@ -697,11 +697,6 @@ void EndpointAppPBX::set_tone(struct port_list *portlist, char *tone)
/* store for suspended processes */
SCPY(e_tone, tone);
- if (!portlist)
- {
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) no endpoint to notify tone.\n", ea_endpoint->ep_serial);
- return;
- }
if (e_join_pattern /* pattern are provided */
&& !(e_ext.own_setup && e_state == EPOINT_STATE_IN_SETUP)
@@ -727,6 +722,10 @@ void EndpointAppPBX::set_tone(struct port_list *portlist, char *tone)
SCPY(message->param.tone.name, tone);
message_put(message);
logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
+ } else
+ {
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) no port to notify tone.\n", ea_endpoint->ep_serial);
+ return;
}
}
@@ -3495,6 +3494,12 @@ void EndpointAppPBX::ea_message_join(unsigned long join_id, int message_type, un
// PDEBUG(DEBUG_EPOINT, "EPOINT(%d) received message %d for active JOIN (terminal %s, caller id %s state=%d)\n", ea_endpoint->ep_serial, message, e_ext.number, e_callerinfo.id, e_state);
switch(message_type)
{
+ /* JOIN SENDS TONE message */
+ case MESSAGE_TONE:
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received tone message: '%d'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->tone.name);
+ set_tone(portlist, param->tone.name);
+ break;
+
/* JOIN SENDS CRYPT message */
case MESSAGE_CRYPT:
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received crypt message: '%d'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->crypt.type);
diff --git a/joinpbx.cpp b/joinpbx.cpp
index 406d9e8..792fc4b 100644
--- a/joinpbx.cpp
+++ b/joinpbx.cpp
@@ -255,6 +255,7 @@ JoinPBX::JoinPBX(class Endpoint *epoint) : Join()
j_pid = getpid();
j_updatebridge = 0;
j_partyline = 0;
+ j_partyline_jingle = 0;
j_multicause = 0;
j_multilocation = 0;
@@ -430,7 +431,7 @@ void JoinPBX::bridge(void)
relation = relation->next;
}
} else
- /* if conference/partyline or (more than two members and more than one is connected), so we set conference state */
+ /* if conference/partyline (or more than two members and more than one is connected), so we set conference state */
{
PDEBUG(DEBUG_JOIN, "join%d %d members, %d connected, signal conference\n", relations, numconnect);
relation = j_relation;
@@ -699,9 +700,10 @@ void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
}
/* process party line */
- if (message_type == MESSAGE_SETUP) if (param->setup.partyline)
+ if (message_type == MESSAGE_SETUP) if (param->setup.partyline && !j_partyline)
{
j_partyline = param->setup.partyline;
+ j_partyline_jingle = param->setup.partyline_jingle;
}
if (j_partyline)
{
@@ -715,6 +717,8 @@ void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
message->param.connectinfo.ntype = INFO_NTYPE_UNKNOWN;
message_put(message);
j_updatebridge = 1; /* update bridge flag */
+ if (j_relation->next && j_partyline_jingle)
+ play_jingle(1);
break;
case MESSAGE_AUDIOPATH:
@@ -739,6 +743,8 @@ void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
case MESSAGE_RELEASE:
PDEBUG(DEBUG_JOIN, "releasing from join\n");
release(relation, 0, 0);
+ if (j_relation && j_partyline_jingle)
+ play_jingle(0);
break;
default:
@@ -1026,3 +1032,20 @@ int JoinPBX::out_setup(unsigned long epoint_id, int message_type, union paramete
}
+/* send play message to all members to play join/release jingle */
+void JoinPBX::play_jingle(int in)
+{
+ struct join_relation *relation;
+ struct message *message;
+
+ relation = j_relation;
+ while(relation)
+ {
+ message = message_create(j_serial, relation->epoint_id, JOIN_TO_EPOINT, MESSAGE_TONE);
+ SCPY(message->param.tone.name, (char *)((in)?"left":"joined"));
+ message_put(message);
+ relation = relation->next;
+ }
+}
+
+
diff --git a/joinpbx.h b/joinpbx.h
index 5cdfdd5..e885e9e 100644
--- a/joinpbx.h
+++ b/joinpbx.h
@@ -69,12 +69,14 @@ class JoinPBX : public Join
struct join_relation *j_relation; /* list of endpoints that are related to the join */
int j_partyline; /* if set, join is conference room */
+ int j_partyline_jingle; /* also play jingle on join/leave */
void bridge(void);
void bridge_data(unsigned long epoint_from, struct join_relation *relation_from, union parameter *param);
void remove_relation(struct join_relation *relation);
struct join_relation *add_relation(void);
int out_setup(unsigned long epoint_id, int message, union parameter *param, char *newnumber);
+ void play_jingle(int in);
};
void joinpbx_debug(class JoinPBX *joinpbx, char *function);
diff --git a/message.h b/message.h
index 203ecca..1db509c 100644
--- a/message.h
+++ b/message.h
@@ -249,6 +249,7 @@ struct message_setup {
int port_type; /* type of port (only required if message is port -> epoint) */
int dtmf; /* used to enabled dtmf dialing at setup state */
int partyline; /* if set, call will be a conference room */
+ int partyline_jingle; /* if set, the jingle will be played on conference join */
struct caller_info callerinfo; /* information about the caller */
struct dialing_info dialinginfo; /* information about dialing */
struct redir_info redirinfo; /* info on redirection (to the calling user) */
diff --git a/route.c b/route.c
index 358bf4d..2546b18 100644
--- a/route.c
+++ b/route.c
@@ -220,6 +220,9 @@ struct param_defs param_defs[] = {
{ PARAM_ROOM,
"room", PARAM_TYPE_INTEGER,
"room=<digits>", "Conference room number, must be greater 0, as in real life."},
+ { PARAM_JINGLE,
+ "jingle", PARAM_TYPE_NULL,
+ "jingle", "Conference members will hear a jingle if a member joins."},
{ PARAM_TIMEOUT,
"timeout", PARAM_TYPE_INTEGER,
"timeout=<seconds>", "Timeout before continue with next action."},
@@ -258,7 +261,7 @@ struct action_defs action_defs[] = {
"Caller is routed to the voice box of given extension."},
{ ACTION_PARTYLINE,
"partyline",&EndpointAppPBX::action_init_partyline, NULL, &EndpointAppPBX::action_hangup_call,
- PARAM_ROOM,
+ PARAM_ROOM | PARAM_JINGLE,
"Caller is participating the conference with the given room number."},
{ ACTION_LOGIN,
"login", NULL, &EndpointAppPBX::action_dialing_login, NULL,
diff --git a/route.h b/route.h
index b887125..22c68e2 100644
--- a/route.h
+++ b/route.h
@@ -131,10 +131,11 @@ enum { /* how to parse text file during startup */
#define PARAM_CALLERIDTYPE (1LL<<37)
#define PARAM_CALLTO (1LL<<38)
#define PARAM_ROOM (1LL<<39)
-#define PARAM_TIMEOUT (1LL<<40)
-#define PARAM_NOPASSWORD (1LL<<41)
-#define PARAM_STRIP (1LL<<42)
-#define PARAM_APPLICATION (1LL<<43)
+#define PARAM_JINGLE (1LL<<40)
+#define PARAM_TIMEOUT (1LL<<41)
+#define PARAM_NOPASSWORD (1LL<<42)
+#define PARAM_STRIP (1LL<<43)
+#define PARAM_APPLICATION (1LL<<44)
/* action index
diff --git a/todo.txt b/todo.txt
index 9f73240..b0caea1 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,4 +1,9 @@
+neue params zum aufbau eines externen/internen calls
+neue params zun aufbau eines externen/internen calls dokumentieren
+
+neue partyline-params und dokumentieren
+
make asterisk call implementation
display message during nothing/play