<definition name="timestamp">
<field name="Timestamp" type="expand"
- value="${expr(ceil((${Event-Date-Timestamp} / 1000000) + $${UNIX_EPOCH_IN_GREGORIAN}))}"
+ value="${expr(ceil((${Event-Date-Timestamp} / 1000000) + ${UNIX_EPOCH_IN_GREGORIAN}))}"
serialize-as="number" />
</definition>
<definition name="debug-call">
<filters>
<filter
- name="${first-of(variable_debug_call|Call-Debug|#$${Call-Debug})}"
+ name="${first-of(variable_debug_call|Call-Debug|#${Call-Debug})}"
type="include" value="true" />
</filters>
<field name="Call-Debug" type="static" serialize-as="object">
value="kazoo_event_name|Event-Subclass|Event-Name" />
<field name="Event-Date-Timestamp" as="Msg-ID" />
<field name="Timestamp" type="expand"
- value="${expr(ceil((${Event-Date-Timestamp} / 1000000) + $${UNIX_EPOCH_IN_GREGORIAN}))}"
+ value="${expr(ceil((${Event-Date-Timestamp} / 1000000) + ${UNIX_EPOCH_IN_GREGORIAN}))}"
serialize-as="number" />
<field name="variable_sip_origination_call_uuid" as="Origination-Call-ID" />
<field name="Call-ID" type="first-of"
<definition name="voice_dialplan">
<field name="fetch-info" type="reference" />
<field name="Timestamp" type="expand"
- value="${expr(ceil((${Event-Date-Timestamp} / 1000000) + $${UNIX_EPOCH_IN_GREGORIAN}))}"
+ value="${expr(ceil((${Event-Date-Timestamp} / 1000000) + ${UNIX_EPOCH_IN_GREGORIAN}))}"
serialize-as="number" />
<field name="Unique-ID" as="Call-ID" />
<field name="variable_sip_invite_domain" as="Domain-Name" />
}
}
-/* kazoo endpoint */
-switch_endpoint_interface_t *kz_endpoint_interface;
-static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *session,
- switch_event_t *var_event,
- switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
- switch_call_cause_t *cancel_cause);
-switch_io_routines_t kz_endpoint_io_routines = {
- /*.outgoing_channel */ kz_endpoint_outgoing_channel
-};
-
static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *session,
switch_event_t *var_event,
- switch_caller_profile_t *outbound_profile,
+ switch_caller_profile_t *outbound_profile_in,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
switch_call_cause_t *cancel_cause)
{
char *cid_num_override = NULL;
switch_event_t *event = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
+ switch_caller_profile_t *outbound_profile = NULL;
- if (zstr(outbound_profile->destination_number)) {
+ if (zstr(outbound_profile_in->destination_number)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "NO DESTINATION NUMBER\n");
goto done;
}
- user = strdup(outbound_profile->destination_number);
+ user = strdup(outbound_profile_in->destination_number);
if (!user)
goto done;
goto done;
}
+ //
+ outbound_profile = outbound_profile_in;
+ /*
+ outbound_profile = switch_caller_profile_dup(outbound_profile_in->pool, outbound_profile_in);
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "CHECKING CALLER-ID\n");
+ if ((x_params = switch_xml_child(x_user, "profile-variables"))) {
+ const char* val = NULL;
+ outbound_profile->soft = NULL;
+ for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
+ const char *pvar = switch_xml_attr(x_param, "name");
+ const char *val = switch_xml_attr(x_param, "value");
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "setting profile var %s = %s\n", pvar, val);
+ switch_caller_profile_set_var(outbound_profile, pvar, val);
+ }
+ // * TODO * verify onnet/offnet
+ if((val=switch_caller_get_field_by_name(outbound_profile, "Endpoint-Caller-ID-Name"))) {
+ outbound_profile->callee_id_name = val;
+ outbound_profile->orig_caller_id_name = val;
+ }
+ if((val=switch_caller_get_field_by_name(outbound_profile, "Endpoint-Caller-ID-Number"))) {
+ outbound_profile->callee_id_number = val;
+ outbound_profile->orig_caller_id_number = val;
+ }
+ }
+ */
+
status = switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
cid_name_override, cid_num_override, outbound_profile, var_event, myflags,
cancel_cause, NULL);
}
}
+
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "CHECKING CALLER-ID\n");
if ((x_params = switch_xml_child(x_user, "profile-variables"))) {
- switch_caller_profile_t *cp = NULL;
+ switch_caller_profile_t *cp = switch_channel_get_caller_profile(new_channel);
const char* val = NULL;
+ cp->soft = NULL;
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
const char *pvar = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "setting profile var %s = %s\n", pvar, val);
switch_channel_set_profile_var(new_channel, pvar, val);
+ //switch_caller_profile_set_var(cp, pvar, val);
}
- cp = switch_channel_get_caller_profile(new_channel);
+ // * TODO * verify onnet/offnet
if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Name"))) {
cp->callee_id_name = val;
cp->orig_caller_id_name = val;
}
+/* kazoo endpoint */
+
+
+switch_io_routines_t kz_endpoint_io_routines = {
+ /*.outgoing_channel */ kz_endpoint_outgoing_channel
+};
+
void add_kz_endpoints(switch_loadable_module_interface_t **module_interface) {
+ switch_endpoint_interface_t *kz_endpoint_interface;
kz_endpoint_interface = (switch_endpoint_interface_t *) switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
kz_endpoint_interface->interface_name = "kz";
kz_endpoint_interface->io_routines = &kz_endpoint_io_routines;