47 #include <sys/socket.h> 50 #include <netinet/in.h> 51 #include <arpa/inet.h> 220 #define DEFAULT_MAX_ICE_CANDIDATES "10" 223 #define DEFAULT_MAX_PAYLOADS "30" 226 #define ENDPOINT_BUCKETS 37 229 #define SESSION_BUCKETS 37 232 #define JINGLE_NS "urn:xmpp:jingle:1" 235 #define JINGLE_RTP_NS "urn:xmpp:jingle:apps:rtp:1" 238 #define JINGLE_RTP_INFO_NS "urn:xmpp:jingle:apps:rtp:info:1" 241 #define JINGLE_ICE_UDP_NS "urn:xmpp:jingle:transports:ice-udp:1" 244 #define GOOGLE_TRANSPORT_NS "http://www.google.com/transport/p2p" 247 #define GOOGLE_TRANSPORT_RAW_NS "http://www.google.com/transport/raw-udp" 250 #define GOOGLE_SESSION_NS "http://www.google.com/session" 253 #define GOOGLE_PHONE_NS "http://www.google.com/session/phone" 256 #define GOOGLE_VIDEO_NS "http://www.google.com/session/video" 259 #define XMPP_STANZAS_NS "urn:ietf:params:xml:ns:xmpp-stanzas" 355 .description =
"Motif Jingle Channel Driver",
418 const char *
sid = obj;
427 const char *
sid = arg;
445 if (endpoint->
rule) {
495 return endpoint->state;
529 const char *
name = obj;
538 const char *
name = arg;
547 .category =
"general",
631 *instance = session->
rtp;
658 session->
owner = chan;
784 if (!(chan =
ast_channel_alloc_with_endpoint(1, state,
S_OR(title,
""),
S_OR(cid_name,
""),
"",
"",
"", assignedids, requestor, 0, endpoint->
connection->
endpoint,
"Motif/%s-%04lx", str, (
unsigned long)(
ast_random() & 0xffff)))) {
836 ast_channel_accountcode_set(chan, endpoint->
accountcode);
840 ast_channel_language_set(chan, endpoint->
language);
844 ast_channel_musicclass_set(chan, endpoint->
musicclass);
868 if (!(response = iks_new(
"iq"))) {
873 iks_insert_attrib(response,
"type",
"result");
874 iks_insert_attrib(response,
"from", connection->
jid->full);
875 iks_insert_attrib(response,
"to", iks_find_attrib(pak->x,
"from"));
876 iks_insert_attrib(response,
"id", iks_find_attrib(pak->x,
"id"));
880 iks_delete(response);
888 if (!(response = iks_new(
"iq")) ||
889 !(error = iks_new(
"error")) ||
890 !(reason = iks_new(reasonstr))) {
895 iks_insert_attrib(response,
"type",
"error");
896 iks_insert_attrib(response,
"from", connection->
jid->full);
897 iks_insert_attrib(response,
"to", iks_find_attrib(pak->x,
"from"));
898 iks_insert_attrib(response,
"id", iks_find_attrib(pak->x,
"id"));
900 iks_insert_attrib(error,
"type", type);
901 iks_insert_node(error, reason);
904 iks_insert_node(error, reason2);
907 iks_insert_node(response, error);
914 iks_delete(response);
927 ast_log(
LOG_ERROR,
"Unable to add ICE-UDP candidates as ICE support not available or no candidates available\n");
932 iks_insert_attrib(transport,
"pwd", ice->
get_password(rtp));
933 iks_insert_attrib(transport,
"ufrag", ice->
get_ufrag(rtp));
938 iks *local_candidate;
941 if (!(local_candidate = iks_new(
"candidate"))) {
943 ast_log(
LOG_ERROR,
"Unable to allocate IKS candidate stanza for ICE-UDP transport\n");
947 snprintf(tmp,
sizeof(tmp),
"%u", candidate->
id);
948 iks_insert_attrib(local_candidate,
"component", tmp);
950 iks_insert_attrib(local_candidate,
"foundation", tmp);
951 iks_insert_attrib(local_candidate,
"generation",
"0");
952 iks_insert_attrib(local_candidate,
"network",
"0");
953 snprintf(tmp,
sizeof(tmp),
"%04lx", (
unsigned long)(
ast_random() & 0xffff));
954 iks_insert_attrib(local_candidate,
"id", tmp);
957 snprintf(tmp,
sizeof(tmp),
"%d", candidate->
priority);
958 iks_insert_attrib(local_candidate,
"priority", tmp);
959 iks_insert_attrib(local_candidate,
"protocol",
"udp");
962 iks_insert_attrib(local_candidate,
"type",
"host");
964 iks_insert_attrib(local_candidate,
"type",
"srflx");
966 iks_insert_attrib(local_candidate,
"type",
"relay");
969 iks_insert_node(transport, local_candidate);
970 candidates[i++] = local_candidate;
989 ast_log(
LOG_ERROR,
"Unable to add Google ICE candidates as ICE support not available or no candidates available\n");
1000 iks *local_candidate;
1002 char ufrag[17] =
"";
1004 if (!(local_candidate = iks_new(
"candidate"))) {
1006 ast_log(
LOG_ERROR,
"Unable to allocate IKS candidate stanza for Google ICE transport\n");
1010 if (candidate->
id == 1) {
1011 iks_insert_attrib(local_candidate,
"name", !video ?
"rtp" :
"video_rtp");
1012 }
else if (candidate->
id == 2) {
1013 iks_insert_attrib(local_candidate,
"name", !video ?
"rtcp" :
"video_rtcp");
1015 iks_delete(local_candidate);
1023 iks_insert_attrib(local_candidate,
"preference",
"0.95");
1024 iks_insert_attrib(local_candidate,
"type",
"local");
1026 iks_insert_attrib(local_candidate,
"preference",
"0.9");
1027 iks_insert_attrib(local_candidate,
"type",
"stun");
1030 iks_insert_attrib(local_candidate,
"protocol",
"udp");
1031 iks_insert_attrib(local_candidate,
"network",
"0");
1032 snprintf(ufrag,
sizeof(ufrag),
"%s", ice->
get_ufrag(rtp));
1033 iks_insert_attrib(local_candidate,
"username", ufrag);
1034 iks_insert_attrib(local_candidate,
"generation",
"0");
1037 iks_insert_attrib(local_candidate,
"password",
"");
1038 iks_insert_attrib(local_candidate,
"foundation",
"0");
1039 iks_insert_attrib(local_candidate,
"component",
"1");
1041 iks_insert_attrib(local_candidate,
"password", ice->
get_password(rtp));
1047 iks_insert_node(transport, local_candidate);
1048 candidates[i++] = local_candidate;
1052 ao2_ref(local_candidates, -1);
1063 !(reason = iks_new(
"reason")) || !(text = iks_new(reasontext))) {
1064 ast_log(
LOG_ERROR,
"Failed to allocate stanzas for session-terminate message on session '%s'\n", session->
sid);
1068 iks_insert_attrib(iq,
"to", session->
remote);
1069 iks_insert_attrib(iq,
"type",
"set");
1074 iks_insert_attrib(jingle,
"type",
"terminate");
1075 iks_insert_attrib(jingle,
"id", session->
sid);
1079 iks_insert_attrib(jingle,
"action",
"session-terminate");
1080 iks_insert_attrib(jingle,
"sid", session->
sid);
1081 iks_insert_attrib(jingle,
"xmlns",
JINGLE_NS);
1084 iks_insert_node(iq, jingle);
1085 iks_insert_node(jingle, reason);
1086 iks_insert_node(reason, text);
1107 if (!(iq = iks_new(
"iq")) || !(jingle = iks_new(
"jingle")) || !(text = iks_new(info))) {
1108 ast_log(
LOG_ERROR,
"Failed to allocate stanzas for session-info message on session '%s'\n", session->
sid);
1112 iks_insert_attrib(iq,
"to", session->
remote);
1113 iks_insert_attrib(iq,
"type",
"set");
1117 iks_insert_attrib(jingle,
"action",
"session-info");
1118 iks_insert_attrib(jingle,
"sid", session->
sid);
1119 iks_insert_attrib(jingle,
"xmlns",
JINGLE_NS);
1120 iks_insert_node(iq, jingle);
1121 iks_insert_node(jingle, text);
1177 if (pvt->
owner == chan) {
1213 iks *iq, *jingle =
NULL, *audio =
NULL, *audio_transport =
NULL, *video =
NULL, *video_transport =
NULL;
1217 if (!(iq = iks_new(
"iq")) ||
1221 ast_log(
LOG_ERROR,
"Failed to allocate stanzas for transport-info message, hanging up session '%s'\n", session->
sid);
1225 memset(audio_candidates, 0,
sizeof(audio_candidates));
1226 memset(video_candidates, 0,
sizeof(video_candidates));
1228 iks_insert_attrib(iq,
"from", session->
connection->
jid->full);
1229 iks_insert_attrib(iq,
"to", from);
1230 iks_insert_attrib(iq,
"type",
"set");
1235 iks_insert_attrib(jingle,
"type",
"candidates");
1236 iks_insert_attrib(jingle,
"id", session->
sid);
1240 iks_insert_attrib(jingle,
"action",
"transport-info");
1241 iks_insert_attrib(jingle,
"sid", session->
sid);
1242 iks_insert_attrib(jingle,
"xmlns",
JINGLE_NS);
1244 iks_insert_node(iq, jingle);
1250 }
else if ((audio = iks_new(
"content")) && (audio_transport = iks_new(
"transport"))) {
1251 iks_insert_attrib(audio,
"creator", session->
outgoing ?
"initiator" :
"responder");
1252 iks_insert_attrib(audio,
"name", session->
audio_name);
1253 iks_insert_node(jingle, audio);
1254 iks_insert_node(audio, audio_transport);
1268 if ((video = iks_new(
"content")) && (video_transport = iks_new(
"transport"))) {
1269 iks_insert_attrib(video,
"creator", session->
outgoing ?
"initiator" :
"responder");
1270 iks_insert_attrib(video,
"name", session->
video_name);
1271 iks_insert_node(jingle, video);
1272 iks_insert_node(video, video_transport);
1293 iks_delete(video_candidates[i]);
1294 iks_delete(audio_candidates[i]);
1297 iks_delete(video_transport);
1299 iks_delete(audio_transport);
1308 int x = 0, i = 0, res = 0;
1322 (!(payload = iks_new(
"payload-type")))) {
1331 snprintf(tmp,
sizeof(tmp),
"%d", rtp_code);
1332 iks_insert_attrib(payload,
"id", tmp);
1334 iks_insert_attrib(payload,
"channels",
"1");
1338 iks_insert_attrib(payload,
"clockrate",
"16000");
1341 iks_insert_attrib(payload,
"clockrate", tmp);
1348 if ((parameter = iks_new(
"parameter"))) {
1349 iks_insert_attrib(parameter,
"name",
"width");
1350 iks_insert_attrib(parameter,
"value",
"640");
1351 iks_insert_node(payload, parameter);
1353 if ((parameter = iks_new(
"parameter"))) {
1354 iks_insert_attrib(parameter,
"name",
"height");
1355 iks_insert_attrib(parameter,
"value",
"480");
1356 iks_insert_node(payload, parameter);
1358 if ((parameter = iks_new(
"parameter"))) {
1359 iks_insert_attrib(parameter,
"name",
"framerate");
1360 iks_insert_attrib(parameter,
"value",
"30");
1361 iks_insert_node(payload, parameter);
1365 iks_insert_node(description, payload);
1366 payloads[i++] = payload;
1374 if ((payload = iks_new(
"payload-type"))) {
1379 iks_insert_attrib(payload,
"id",
"101");
1380 iks_insert_attrib(payload,
"name",
"telephone-event");
1381 iks_insert_attrib(payload,
"channels",
"1");
1382 iks_insert_attrib(payload,
"clockrate",
"8000");
1383 iks_insert_node(description, payload);
1384 payloads[i++] = payload;
1398 iks_insert_attrib(content,
"creator", session->
outgoing ?
"initiator" :
"responder");
1399 iks_insert_attrib(content,
"name", name);
1400 iks_insert_node(jingle, content);
1404 iks_insert_attrib(description,
"media",
"audio");
1406 iks_insert_attrib(description,
"media",
"video");
1410 iks_insert_node(content, description);
1413 iks_insert_node(jingle, description);
1419 iks_insert_node(content, transport);
1422 iks_insert_node(content, transport);
1432 iks *iq, *jingle, *audio =
NULL, *audio_description =
NULL, *video =
NULL, *video_description =
NULL;
1434 iks *audio_transport =
NULL, *video_transport =
NULL;
1437 if (!(iq = iks_new(
"iq")) ||
1444 memset(audio_payloads, 0,
sizeof(audio_payloads));
1445 memset(video_payloads, 0,
sizeof(video_payloads));
1447 iks_insert_attrib(iq,
"from", session->
connection->
jid->full);
1448 iks_insert_attrib(iq,
"to", session->
remote);
1449 iks_insert_attrib(iq,
"type",
"set");
1454 iks_insert_attrib(jingle,
"type", action);
1455 iks_insert_attrib(jingle,
"id", session->
sid);
1458 iks_insert_attrib(jingle,
"action", action);
1459 iks_insert_attrib(jingle,
"sid", session->
sid);
1460 iks_insert_attrib(jingle,
"xmlns",
JINGLE_NS);
1463 if (!strcasecmp(action,
"session-initiate") || !strcasecmp(action,
"initiate") || !strcasecmp(action,
"accept")) {
1467 iks_insert_node(iq, jingle);
1469 if (session->
rtp && (audio = iks_new(
"content")) && (audio_description = iks_new(
"description")) &&
1470 (audio_transport = iks_new(
"transport"))) {
1474 ast_log(
LOG_ERROR,
"Failed to allocate audio content stanzas for session '%s', hanging up\n", session->
sid);
1479 if ((video = iks_new(
"content")) && (video_description = iks_new(
"description")) &&
1480 (video_transport = iks_new(
"transport"))) {
1484 ast_log(
LOG_ERROR,
"Failed to allocate video content stanzas for session '%s', hanging up\n", session->
sid);
1495 iks_delete(video_transport);
1496 iks_delete(audio_transport);
1499 iks_delete(video_payloads[i]);
1500 iks_delete(audio_payloads[i]);
1503 iks_delete(video_description);
1505 iks_delete(audio_description);
1527 iks *
error = iks_find(pak->x,
"error"), *redirect;
1555 if ((redirect = iks_find_with_attrib(error,
"redirect",
"xmlns",
XMPP_STANZAS_NS))) {
1556 iks *to = iks_child(redirect);
1561 if (!strncmp(target,
"xmpp:", 5)) {
1578 }
else if (iks_find_with_attrib(error,
"service-unavailable",
"xmlns",
XMPP_STANZAS_NS)) {
1580 }
else if (iks_find_with_attrib(error,
"resource-constraint",
"xmlns",
XMPP_STANZAS_NS)) {
1582 }
else if (iks_find_with_attrib(error,
"bad-request",
"xmlns",
XMPP_STANZAS_NS)) {
1584 }
else if (iks_find_with_attrib(error,
"remote-server-not-found",
"xmlns",
XMPP_STANZAS_NS)) {
1586 }
else if (iks_find_with_attrib(error,
"feature-not-implemented",
"xmlns",
XMPP_STANZAS_NS)) {
1621 return IKS_FILTER_EAT;
1657 if (session->
vrtp) {
1662 if (session->
vrtp) {
1673 ast_debug(1,
"Bogus frame of format '%s' received from '%s'!\n",
1680 ast_debug(1,
"Oooh, format changed to %s\n",
1709 "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
1716 if (session && session->
rtp) {
1721 if (session && session->
vrtp) {
1754 switch (condition) {
1877 const char *reason =
"success";
1908 char *
dialed, target[1024] =
"";
1921 ast_log(
LOG_ERROR,
"Motif channel driver requires an audio format when dialing a destination\n");
1950 if (!endpoint->connection) {
1951 ast_log(
LOG_ERROR,
"Unable to create Jingle session on endpoint '%s' as no valid connection exists\n",
args.name);
1966 snprintf(target,
sizeof(target),
"%s/%s",
args.target, resource->
resource);
1970 snprintf(target,
sizeof(target),
"%s/%s",
args.target, resource->
resource);
1988 ast_log(
LOG_ERROR,
"Unable to create Jingle session on endpoint '%s' as no capable resource for target '%s' was found\n",
args.name,
args.target);
2027 ao2_link(endpoint->state->sessions, session);
2035 char *media = iks_find_attrib(description,
"media");
2038 int othercapability = 0;
2045 ast_log(
LOG_ERROR,
"Received a content description on session '%s' without a name\n", session->
sid);
2050 if (!strcasecmp(media,
"audio")) {
2054 *rtp = session->
rtp;
2057 }
else if (!strcasecmp(media,
"video")) {
2063 *rtp = session->
vrtp;
2066 if (!session->
vrtp) {
2068 ast_log(
LOG_ERROR,
"Received a video content description on session '%s' but could not enable video\n", session->
sid);
2077 ast_log(
LOG_ERROR,
"Unsupported media type '%s' received in content description on session '%s'\n", media, session->
sid);
2083 ast_log(
LOG_ERROR,
"Could not initialize codecs for negotiation on session '%s'\n", session->
sid);
2088 for (codec = iks_child(description); codec; codec = iks_next(codec)) {
2089 char *
id = iks_find_attrib(codec,
"id");
2090 char *attr_name = iks_find_attrib(codec,
"name");
2091 char *clockrate = iks_find_attrib(codec,
"clockrate");
2092 int rtp_id, rtp_clockrate;
2095 if (!
ast_strlen_zero(clockrate) && (sscanf(clockrate,
"%30d", &rtp_clockrate) == 1)) {
2123 char *ufrag = iks_find_attrib(transport,
"ufrag"), *pwd = iks_find_attrib(transport,
"pwd");
2128 ast_log(
LOG_ERROR,
"Received ICE-UDP transport information on session '%s' but ICE support not available\n", session->
sid);
2136 for (candidate = iks_child(transport); candidate; candidate = iks_next(candidate)) {
2137 char *component = iks_find_attrib(candidate,
"component"), *foundation = iks_find_attrib(candidate,
"foundation");
2138 char *generation = iks_find_attrib(candidate,
"generation"), *
id = iks_find_attrib(candidate,
"id");
2139 char *ip = iks_find_attrib(candidate,
"ip"), *port = iks_find_attrib(candidate,
"port");
2140 char *
priority = iks_find_attrib(candidate,
"priority"), *protocol = iks_find_attrib(candidate,
"protocol");
2141 char *
type = iks_find_attrib(candidate,
"type");
2151 ast_log(
LOG_ERROR,
"Incomplete ICE-UDP candidate received on session '%s'\n", session->
sid);
2155 if ((sscanf(component,
"%30u", &local_candidate.
id) != 1) ||
2156 (sscanf(priority,
"%30u", (
unsigned *)&local_candidate.
priority) != 1) ||
2157 (sscanf(port,
"%30d", &real_port) != 1)) {
2159 ast_log(
LOG_ERROR,
"Invalid ICE-UDP candidate information received on session '%s'\n", session->
sid);
2175 if (!strcasecmp(type,
"host")) {
2177 }
else if (!strcasecmp(type,
"srflx")) {
2179 }
else if (!strcasecmp(type,
"relay")) {
2208 ast_log(
LOG_ERROR,
"Received Google transport information on session '%s' but ICE support not available\n", session->
sid);
2221 for (candidate = iks_child(transport); candidate; candidate = iks_next(candidate)) {
2222 char *
address = iks_find_attrib(candidate,
"address"), *port = iks_find_attrib(candidate,
"port");
2223 char *username = iks_find_attrib(candidate,
"username"), *
name = iks_find_attrib(candidate,
"name");
2224 char *protocol = iks_find_attrib(candidate,
"protocol");
2228 char combined[33] =
"";
2231 if (strcasecmp(iks_name(candidate),
"candidate") &&
2232 strcasecmp(iks_name(candidate),
"p:candidate") &&
2233 strcasecmp(iks_name(candidate),
"ses:candidate")) {
2241 ast_log(
LOG_ERROR,
"Incomplete Google candidate received on session '%s'\n", session->
sid);
2251 if (strcasecmp(
name,
"rtp") && strcasecmp(
name,
"video_rtp")) {
2256 if (sscanf(port,
"%30d", &real_port) != 1) {
2258 ast_log(
LOG_ERROR,
"Invalid Google candidate port '%s' received on session '%s'\n", port, session->
sid);
2265 snprintf(combined,
sizeof(combined),
"%s%s", username, ice->
get_ufrag(rtp));
2282 unsigned int changed = 0;
2286 for (content = iks_child(iks_child(pak->x)); content; content = iks_next(content)) {
2289 iks *description, *transport;
2292 if (!strcmp(iks_name(content),
"conference-info")) {
2296 name = iks_find_attrib(content,
"name");
2300 if (
ast_strlen_zero(name) && !(name = iks_find_attrib(content,
"jin:name"))) {
2309 }
else if (!strcmp(session->
video_name, name)) {
2310 rtp = session->
vrtp;
2318 if ((description = iks_find_with_attrib(content,
"description",
"xmlns",
JINGLE_RTP_NS)) ||
2319 (description = iks_find_with_attrib(content,
"rtp:description",
"xmlns:rtp",
JINGLE_RTP_NS)) ||
2320 (description = iks_find_with_attrib(content,
"pho:description",
"xmlns:pho",
GOOGLE_PHONE_NS)) ||
2321 (description = iks_find_with_attrib(pak->query,
"description",
"xmlns",
GOOGLE_PHONE_NS)) ||
2322 (description = iks_find_with_attrib(pak->query,
"pho:description",
"xmlns:pho",
GOOGLE_PHONE_NS)) ||
2323 (description = iks_find_with_attrib(pak->query,
"vid:description",
"xmlns",
GOOGLE_VIDEO_NS))) {
2335 ast_log(
LOG_ERROR,
"Received a content stanza but have no RTP instance for it on session '%s'\n", session->
sid);
2341 if ((transport = iks_find_with_attrib(content,
"transport",
"xmlns",
JINGLE_ICE_UDP_NS))) {
2345 }
else if ((transport = iks_find_with_attrib(content,
"transport",
"xmlns",
GOOGLE_TRANSPORT_NS)) ||
2346 (transport = iks_find_with_attrib(content,
"p:transport",
"xmlns:p",
GOOGLE_TRANSPORT_NS)) ||
2347 (transport = iks_find_with_attrib(pak->x,
"session",
"xmlns",
GOOGLE_SESSION_NS)) ||
2348 (transport = iks_find_with_attrib(pak->x,
"ses:session",
"xmlns:ses",
GOOGLE_SESSION_NS))) {
2353 }
else if (iks_find(content,
"transport")) {
2356 ast_log(
LOG_ERROR,
"Unsupported transport type received on session '%s'\n", session->
sid);
2404 if ((sid = iks_find_attrib(pak->query,
"id"))) {
2407 }
else if (!(sid = iks_find_attrib(pak->query,
"sid"))) {
2413 if (!(session =
jingle_alloc(endpoint, pak->from->full, sid))) {
2465 "unknown-session xmlns='urn:xmpp:jingle:errors:1'");
2480 "unknown-session xmlns='urn:xmpp:jingle:errors:1'");
2504 "unknown-session xmlns='urn:xmpp:jingle:errors:1'");
2521 }
else if (iks_find_with_attrib(pak->query,
"unhold",
"xmlns",
JINGLE_RTP_INFO_NS)) {
2539 int data_size =
sizeof(*cause_code);
2543 "unknown-session xmlns='urn:xmpp:jingle:errors:1'");
2554 if ((reason = iks_find(pak->query,
"reason")) && (text = iks_child(reason))) {
2558 data_size += 6 + strlen(iks_name(text));
2560 memset(cause_code, 0, data_size);
2571 snprintf(cause_code->
code, data_size -
sizeof(*cause_code) + 1,
"Motif %s", iks_name(text));
2575 memset(cause_code, 0, data_size);
2583 ast_debug(3,
"Hanging up channel '%s' due to session terminate message with cause '%d'\n",
ast_channel_name(chan), cause);
2598 const char *sid =
NULL;
2604 if (!(action = iks_find_attrib(pak->query,
"action")) &&
2605 !(action = iks_find_attrib(pak->query,
"type"))) {
2608 return IKS_FILTER_EAT;
2616 if (!(sid = iks_find_attrib(pak->query,
"sid"))) {
2618 sid = iks_find_attrib(pak->query,
"id");
2643 ast_log(
LOG_NOTICE,
"Received action '%s' for session '%s' that has no handler\n", action, sid);
2654 return IKS_FILTER_EAT;
2662 if (!strcasecmp(var->
name,
"callgroup")) {
2664 }
else if (!strcasecmp(var->
name,
"pickupgroup")) {
2687 IKS_RULE_TYPE, IKS_PAK_IQ,
2703 if (!strcasecmp(var->
value,
"ice-udp")) {
2705 }
else if (!strcasecmp(var->
value,
"google")) {
2707 }
else if (!strcasecmp(var->
value,
"google-v1")) {
2757 ast_log(
LOG_ERROR,
"Unable to read config file motif.conf. Module loaded but not running.\n");
2829 .requires =
"res_xmpp",
static void jingle_action_transport_info(struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak)
Handler function for the 'transport-info' action.
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, struct ast_format_cap *astformats, int *nonastformats)
Retrieve all formats that were found.
int ast_xmpp_client_send_message(struct ast_xmpp_client *client, const char *user, const char *message)
Send a message to a given user using an established XMPP client connection.
int ast_sched_start_thread(struct ast_sched_context *con)
Start a thread for processing scheduler entries.
#define AST_CAUSE_PROTOCOL_ERROR
const ast_string_field audio_name
static char musicclass[MAX_MUSICCLASS]
Type for default option handler for format capabilities.
unsigned long long ast_group_t
enum sip_cc_notify_state state
static char accountcode[AST_MAX_ACCOUNT_CODE]
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
const ast_string_field sid
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
static struct jingle_session * jingle_alloc(struct jingle_endpoint *endpoint, const char *from, const char *sid)
Internal helper function used to allocate Jingle session on an endpoint.
static void jingle_endpoint_destructor(void *obj)
Destructor for Jingle endpoints.
static int jingle_digit_begin(struct ast_channel *ast, char digit)
Function called by core to start a DTMF digit.
Asterisk locking-related definitions:
static void jingle_enable_video(struct jingle_session *session)
Internal helper function which enables video support on a sesson if possible.
static void jingle_endpoint_state_destructor(void *obj)
Destructor for Jingle endpoint state.
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_channel_tech jingle_tech
PBX interface structure for channel registration.
char chan_name[AST_CHANNEL_NAME]
static char parkinglot[AST_MAX_CONTEXT]
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
struct ast_format_cap * cap
void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid)
Set the channel that owns this RTP instance.
#define ast_channel_alloc_with_endpoint(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint,...)
static int jingle_endpoint_cmp(void *obj, void *arg, int flags)
Comparator function for Jingle endpoints.
static int jingle_action_hook(void *data, ikspak *pak)
Callback for when a Jingle action is received from an endpoint.
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
void ast_rtp_instance_change_source(struct ast_rtp_instance *instance)
Indicate a new source of audio has dropped in and the ssrc should change.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
struct jingle_endpoint_state * state
#define DEFAULT_MAX_ICE_CANDIDATES
Default maximum number of ICE candidates we will offer.
const char *(* get_password)(struct ast_rtp_instance *instance)
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
static int jingle_interpret_google_transport(struct jingle_session *session, iks *transport, struct ast_rtp_instance *rtp)
Helper function which handles Google transport information.
#define GOOGLE_TRANSPORT_NS
Namespace for Google Talk ICE-UDP.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
static void jingle_action_session_accept(struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak)
Handler function for the 'session-accept' action.
static int jingle_add_google_candidates_to_transport(struct ast_rtp_instance *rtp, iks *transport, iks **candidates, unsigned int video, enum jingle_transport transport_type, unsigned int maximum)
Internal helper function which adds Google candidates to a transport node.
#define AST_CAUSE_SWITCH_CONGESTION
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
static void jingle_send_response(struct ast_xmpp_client *connection, ikspak *pak)
Internal helper function which sends a response.
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_rtp_codecs * ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance)
Get the codecs structure of an RTP instance.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
Defined handlers for different Jingle actions.
#define GOOGLE_PHONE_NS
Namespace for Google Phone description.
static void jingle_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
Function called by RTP engine to get peer capabilities.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
#define AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE
Structure for variables, used for configurations and for channel variables.
static int jingle_session_hash(const void *obj, const int flags)
Hashing function for Jingle sessions.
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
#define ast_rtp_glue_register(glue)
const ast_string_field language
static int jingle_write(struct ast_channel *ast, struct ast_frame *f)
Function called by core to write frames.
static int jingle_interpret_ice_udp_transport(struct jingle_session *session, iks *transport, struct ast_rtp_instance *rtp)
Helper function which handles ICE-UDP transport information.
Structure to pass both assignedid values to channel drivers.
const ast_string_field name
struct jingle_endpoint_state * state
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
ast_channel_state
ast_channel states
struct ast_rtp_engine_ice * ast_rtp_instance_get_ice(struct ast_rtp_instance *instance)
Obtain a pointer to the ICE support present on an RTP instance.
void(* add_remote_candidate)(struct ast_rtp_instance *instance, const struct ast_rtp_engine_ice_candidate *candidate)
static struct jingle_endpoint_state * jingle_endpoint_state_find_or_create(const char *category)
State find/create function.
char resource[XMPP_MAX_RESJIDLEN]
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
struct ao2_container * endpoints
#define ao2_global_obj_ref(holder)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
struct ast_format_cap * jointcap
struct ast_channel * owner
int ast_channel_register(const struct ast_channel_tech *tech)
Register a channel technology (a new channel driver) Called by a channel module to register the kind ...
#define ast_str_alloca(init_len)
void ast_rtp_codecs_set_framing(struct ast_rtp_codecs *codecs, unsigned int framing)
Set the framing used for a set of codecs.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
void(* stop)(struct ast_rtp_instance *instance)
#define AST_CAUSE_NO_USER_RESPONSE
Session which contains information about an active session.
I/O Management (derived from Cheops-NG)
The representation of a single configuration file to be processed.
Common implementation-independent jitterbuffer stuff.
static void jingle_send_session_terminate(struct jingle_session *session, const char *reasontext)
Internal function which sends a session-terminate message.
void(* handler)(struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak)
static int jingle_hangup(struct ast_channel *ast)
Function called by core to hang up a Jingle session.
Structure for an ICE candidate.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
Socket address structure.
#define ACO_TYPES(...)
A helper macro to ensure that aco_info types always have a sentinel.
static int jingle_session_cmp(void *obj, void *arg, int flags)
Comparator function for Jingle sessions.
struct ast_rtp_instance * rtp
static const struct jingle_action_handler jingle_action_handlers[]
int ast_xmpp_client_send(struct ast_xmpp_client *client, iks *stanza)
Send an XML stanza out using an established XMPP client connection.
int ast_callid_threadassoc_remove(void)
Removes callid from thread storage of the calling thread.
struct ast_frame_subclass subclass
static int jingle_interpret_description(struct jingle_session *session, iks *description, const char *name, struct ast_rtp_instance **rtp)
Helper function which handles content descriptions.
ast_callid ast_read_threadstorage_callid(void)
extracts the callerid from the thread
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
#define ast_strlen_zero(foo)
#define JINGLE_RTP_INFO_NS
Namespace for Jingle RTP info.
#define ENDPOINT_BUCKETS
Number of buckets for endpoints.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
void ast_rtp_instance_stun_request(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username)
Request that the underlying RTP engine send a STUN BIND request.
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
static int ast_sockaddr_isnull(const struct ast_sockaddr *addr)
Checks if the ast_sockaddr is null. "null" in this sense essentially means uninitialized, or having a 0 length.
enum ast_rtp_ice_candidate_type type
int ast_callid_threadassoc_add(ast_callid callid)
Adds a known callid to thread storage of the calling thread.
void ast_xmpp_increment_mid(char *mid)
Helper function which increments the message identifier.
static char * ast_sockaddr_stringify_port(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return a port only.
static void jingle_send_session_accept(struct jingle_session *session)
Internal function which sends a session-accept message.
#define ast_debug(level,...)
Log a DEBUG message.
const ast_string_field context
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
const ast_string_field musicclass
void ast_rtp_instance_stop(struct ast_rtp_instance *instance)
Stop an RTP instance.
static void jingle_set_owner(struct jingle_session *session, struct ast_channel *chan)
Set the channel owner on the jingle_session object and related objects.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
struct ast_format_cap * cap
General Asterisk PBX channel definitions.
void ast_channel_rings_set(struct ast_channel *chan, int value)
const char * ast_rtp_lookup_mime_subtype2(const int asterisk_format, const struct ast_format *format, int code, enum ast_rtp_options options)
Retrieve mime subtype information on a payload.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Type for default option handler for unsigned integers.
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, int asterisk_format, struct ast_format *format, int code)
Retrieve a rx mapped payload type based on whether it is an Asterisk format and the code...
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
static struct ast_mansession session
struct aco_type * endpoint_options[]
Access Control of various sorts.
static struct aco_type endpoint_option
#define AST_CAUSE_NORMAL_CLEARING
Scheduler Routines (derived from cheops)
#define AST_STRING_FIELD(name)
Declare a string field.
static struct ao2_container * endpoints
#define ao2_ref(o, delta)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
long int ast_random(void)
static void jingle_action_session_terminate(struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak)
Handler function for the 'session-terminate' action.
#define ast_strdupa(s)
duplicate a string in memory from the stack
static AO2_GLOBAL_OBJ_STATIC(globals)
static char language[MAX_LANGUAGE]
static struct console_pvt globals
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
ast_group_t ast_get_group(const char *s)
Endpoint state information.
static int jingle_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
Function called by core to stop a DTMF digit.
unsigned int maxicecandidates
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimetype, char *mimesubtype, enum ast_rtp_options options)
Record tx payload type information that was seen in an a=rtpmap: SDP line.
#define AST_CAUSE_FACILITY_NOT_IMPLEMENTED
Structure to describe a channel "technology", ie a channel driver See for examples: ...
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
Core PBX routines and definitions.
static void * jingle_endpoint_alloc(const char *cat)
Allocator function for Jingle endpoints.
static int unload_module(void)
Unload the jingle channel from Asterisk.
Their was an error and no changes were applied.
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
int ast_channel_fdno(const struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
struct ast_party_dialed dialed
Dialed/Called information.
static int jingle_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, const struct ast_format_cap *cap, int nat_active)
Function called by RTP engine to change where the remote party should send media. ...
void ast_xmpp_client_unref(struct ast_xmpp_client *client)
Release XMPP client connection reference.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
jingle_transport
The various transport methods supported, from highest priority to lowest priority when doing fallback...
static struct ast_channel * jingle_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
Function called by core to create a new outgoing Jingle session.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
const char *(* get_ufrag)(struct ast_rtp_instance *instance)
Configuration option-handling.
Endpoint which contains configuration information and active sessions.
void(* set_authentication)(struct ast_rtp_instance *instance, const char *ufrag, const char *password)
static void * jingle_endpoint_find(struct ao2_container *tmp_container, const char *category)
Find function for Jingle endpoints.
static void jingle_queue_hangup_with_cause(struct jingle_session *session, int cause)
Helper function which queues a hangup frame with cause code.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
struct ao2_container *(* get_local_candidates)(struct ast_rtp_instance *instance)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
ast_callid ast_create_callid(void)
factory function to create a new uniquely identifying callid.
static int jingle_call(struct ast_channel *ast, const char *dest, int timeout)
Function called by core to actually start calling a remote party.
#define ao2_unlink(container, obj)
char remote_original[XMPP_MAX_JIDLEN]
#define ast_sockaddr_set_port(addr, port)
Sets the port number of a socket address.
struct ast_rtp_instance * vrtp
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
#define AST_CAUSE_CHANNEL_UNACCEPTABLE
#define ao2_global_obj_release(holder)
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
static int jingle_interpret_content(struct jingle_session *session, ikspak *pak)
Helper function which locates content stanzas and interprets them.
#define ast_rtp_instance_set_remote_address(instance, address)
Set the address of the remote endpoint that we are sending RTP to.
enum ast_rtp_ice_component_type id
static int jingle_outgoing_hook(void *data, ikspak *pak)
Callback for when a response is received for an outgoing session-initiate message.
int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit)
Begin sending a DTMF digit.
static void jingle_action_session_initiate(struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak)
Action handlers.
static const struct jingle_reason_mapping jingle_reason_mappings[]
CONFIG_INFO_STANDARD(cfg_info, globals, jingle_config_alloc,.files=ACO_FILES(&jingle_conf),)
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
struct ast_xmpp_client * connection
#define ao2_iterator_next(iter)
#define XMPP_STANZAS_NS
Namespace for XMPP stanzas.
#define ao2_alloc(data_size, destructor_fn)
#define JINGLE_RTP_NS
Namespace for Jingle RTP sessions.
static int custom_group_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for groups.
struct ast_format_cap * capabilities
int ast_softhangup_nolock(struct ast_channel *chan, int reason)
Softly hangup up a channel (no channel lock)
static int reload(void)
Reload module.
static int jingle_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
Function called by core to change the underlying owner channel.
#define ast_channel_unlock(chan)
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, const struct ast_format *format, int code)
Get the sample rate associated with known RTP payload types.
void(* start)(struct ast_rtp_instance *instance)
static int jingle_add_payloads_to_description(struct jingle_session *session, struct ast_rtp_instance *rtp, iks *description, iks **payloads, enum ast_media_type type)
Internal helper function which adds payloads to a description.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
struct ast_endpoint * endpoint
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
struct ast_xmpp_client * connection
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
char remote[XMPP_MAX_JIDLEN]
Module has failed to load, may be in an inconsistent state.
static int jingle_add_content(struct jingle_session *session, iks *jingle, iks *content, iks *description, iks *transport, const char *name, enum ast_media_type type, struct ast_rtp_instance *rtp, iks **payloads)
Helper function which adds content to a description.
#define ao2_find(container, arg, flags)
struct ao2_container * resources
static int jingle_sendtext(struct ast_channel *ast, const char *text)
Function called by core to send text to the remote party of the Jingle session.
#define AST_CAUSE_INTERWORKING
void ast_rtp_codecs_payloads_destroy(struct ast_rtp_codecs *codecs)
Destroy the contents of an RTP codecs structure (but not the structure itself)
#define ast_string_field_build(x, field, fmt, args...)
Set a field to a complex (built) value.
static void jingle_action_session_info(struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak)
Handler function for the 'session-info' action.
int ast_rtp_instance_destroy(struct ast_rtp_instance *instance)
Destroy an RTP instance.
static int jingle_endpoint_hash(const void *obj, const int flags)
Hashing function for Jingle endpoints.
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
static int jingle_answer(struct ast_channel *ast)
Function called by core when we should answer a Jingle session.
static char cid_name[AST_MAX_EXTENSION]
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid value)
struct aco_file jingle_conf
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
static struct ast_rtp_glue jingle_rtp_glue
Local glue for interacting with the RTP engine core.
struct ast_frame ast_null_frame
void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance)
Copy payload information from one RTP instance to another.
static void jingle_session_destructor(void *obj)
Destructor for Jingle sessions.
#define AST_CAUSE_REQUESTED_CHAN_UNAVAIL
#define SESSION_BUCKETS
Number of buckets for sessions, on a per-endpoint basis.
#define AST_CAUSE_NO_ROUTE_DESTINATION
#define GOOGLE_VIDEO_NS
Namespace for Google Video description.
static void jingle_send_error_response(struct ast_xmpp_client *connection, ikspak *pak, const char *type, const char *reasonstr, const char *reasonstr2)
Internal helper function which sends an error response.
#define ast_channel_ref(c)
Increase channel reference count.
#define DEFAULT_MAX_PAYLOADS
Default maximum number of payloads we will offer.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
int ast_rtp_codecs_payloads_initialize(struct ast_rtp_codecs *codecs)
Initialize an RTP codecs structure.
Standard Command Line Interface.
static int load_module(void)
Load the module.
int ast_channel_hangupcause(const struct ast_channel *chan)
Type information about a category-level configurable object.
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
const char * ast_channel_name(const struct ast_channel *chan)
static struct ast_sched_context * sched
enum jingle_transport transport
static struct ast_channel * jingle_session_lock_full(struct jingle_session *pvt)
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
static void handler(const char *name, int response_code, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue)
Unregister RTP glue.
static void * jingle_config_alloc(void)
Allocator called when module configuration should appear.
static const char channel_type[]
Reason text <-> cause code mapping.
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
int ast_sockaddr_is_ipv4(const struct ast_sockaddr *addr)
Determine if the address is an IPv4 address.
int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt, char *mimetype, char *mimesubtype, enum ast_rtp_options options, unsigned int sample_rate)
Set tx payload type to a known MIME media type for a codec with a specific sample rate...
Data structure associated with a single frame of data.
static void jingle_send_transport_info(struct jingle_session *session, const char *from)
Internal function which sends a transport-info message.
#define JINGLE_ICE_UDP_NS
Namespace for Jingle ICE-UDP.
Internal Asterisk hangup causes.
const ast_string_field accountcode
Structure that represents the optional ICE support within an RTP engine.
static struct ast_frame * jingle_read(struct ast_channel *ast)
Function called by core to read any waiting frames.
Type for default option handler for stringfields.
struct ast_format_cap * peercap
static void jingle_send_session_initiate(struct jingle_session *session)
Internal function which sends a session-inititate message.
enum jingle_transport transport
int error(const char *format,...)
void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
Set the value of an RTP instance property.
union ast_frame::@263 data
ast_media_type
Types of media.
enum ast_frame_type frametype
struct ast_sockaddr address
struct ast_xmpp_client * ast_xmpp_client_find(const char *name)
Find an XMPP client connection using a given name.
#define GOOGLE_SESSION_NS
Namespace for Google Session.
static char context[AST_MAX_CONTEXT]
int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration)
struct ast_xmpp_capabilities caps
struct ast_format * format
static struct ast_channel * jingle_new(struct jingle_endpoint *endpoint, struct jingle_session *session, int state, const char *title, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *cid_name)
Function called to create a new Jingle Asterisk channel.
static void jingle_send_session_info(struct jingle_session *session, const char *info)
Internal function which sends a session-info message.
struct ast_rtp_instance * ast_rtp_instance_new(const char *engine_name, struct ast_sched_context *sched, const struct ast_sockaddr *sa, void *data)
Create a new RTP instance.
const ast_string_field video_name
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define AST_CAUSE_CALL_REJECTED
void ast_channel_priority_set(struct ast_channel *chan, int value)
Pluggable RTP Architecture.
static int custom_connection_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for connection.
void ast_rtp_instance_update_source(struct ast_rtp_instance *instance)
Indicate that the RTP marker bit should be set on an RTP stream.
unsigned int maxicecandidates
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
struct ao2_container * sessions
static int custom_transport_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for transport.
static snd_pcm_format_t format
#define ast_rtp_instance_get_remote_address(instance, address)
Get the address of the remote endpoint that we are sending RTP to.
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static int jingle_add_ice_udp_candidates_to_transport(struct ast_rtp_instance *rtp, iks *transport, iks **candidates, unsigned int maximum)
Internal helper function which adds ICE-UDP candidates to a transport node.
static void jingle_send_session_action(struct jingle_session *session, const char *action)
Internal function which sends a complete session message.
void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash on the given channel. ...
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
#define AST_CAUSE_CONGESTION
#define JINGLE_NS
Namespace for Jingle itself.
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
static char * ast_sockaddr_stringify_host(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only, suitable for a URL (with brack...
static void jingle_config_destructor(void *obj)
Destructor called when module configuration goes away.
#define AST_APP_ARG(name)
Define an application argument.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
static struct jingle_endpoint_state * jingle_endpoint_state_create(void)
Allocator function for Jingle endpoint state.
Channels have this property if they can create jitter; i.e. most VoIP channels.
void(* ice_lite)(struct ast_rtp_instance *instance)
#define ao2_link(container, obj)
static enum ast_rtp_glue_result jingle_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
Function called by RTP engine to get local RTP peer.
static int jingle_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen)
Function called by core to ask the channel to indicate some sort of condition.