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;
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;
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;
/* 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));
/* 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)
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;
}
}
// 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);
j_pid = getpid();
j_updatebridge = 0;
j_partyline = 0;
+ j_partyline_jingle = 0;
j_multicause = 0;
j_multilocation = 0;
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;
}
/* 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)
{
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:
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:
}
+/* 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;
+ }
+}
+
+
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);
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) */
{ 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."},
"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,
#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
+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