#include <asterisk.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <sys/socket.h>#include <sys/param.h>#include <arpa/inet.h>#include <net/if.h>#include <netinet/in.h>#include <netinet/in_systm.h>#include <netinet/ip.h>#include <unistd.h>#include <netdb.h>#include <errno.h>#include <fcntl.h>#include <sys/signal.h>#include <asterisk/lock.h>#include <asterisk/channel.h>#include <asterisk/config.h>#include <asterisk/logger.h>#include <asterisk/module.h>#include <asterisk/pbx.h>#include <asterisk/utils.h>#include <asterisk/options.h>#include <asterisk/sched.h>#include <asterisk/io.h>#include <asterisk/causes.h>#include <asterisk/rtp.h>#include <asterisk/acl.h>#include <asterisk/callerid.h>#include <asterisk/file.h>#include <asterisk/cli.h>#include <asterisk/app.h>#include <asterisk/musiconhold.h>#include <asterisk/manager.h>#include <asterisk/dsp.h>#include <asterisk/stringfields.h>#include "ootypes.h"#include "ooCapability.h"#include "oochannels.h"#include "ooh323ep.h"#include "ooh323cDriver.h"#include "ooCalls.h"#include "ooq931.h"#include "ooStackCmds.h"#include "ooGkClient.h"


Go to the source code of this file.
Functions | |
| void | close_rtp_connection (ooCallData *call) |
| int | configure_local_rtp (struct ooh323_pvt *p, ooCallData *call) |
| int | delete_peers (void) |
| int | delete_users (void) |
| struct ooh323_peer * | find_peer (const char *name, int port) |
| struct ooh323_user * | find_user (const char *name, const char *ip) |
| int | ooh323_convert_hangupcause_asteriskToH323 (int cause) |
| int | ooh323_convert_hangupcause_h323ToAsterisk (int cause) |
| int | ooh323_convertAsteriskCapToH323Cap (int cap) |
| void | ooh323_delete_peer (struct ooh323_peer *peer) |
| int | ooh323_destroy (struct ooh323_pvt *p) |
| int | ooh323_onReceivedDigit (OOH323CallData *call, const char *digit) |
| int | ooh323_onReceivedSetup (ooCallData *call, Q931Message *pmsg) |
| struct ast_frame * | ooh323_rtp_read (struct ast_channel *ast, struct ooh323_pvt *p) |
| void | ooh323_set_read_format (ooCallData *call, int fmt) |
| void | ooh323_set_write_format (ooCallData *call, int fmt) |
| int | ooh323_update_capPrefsOrderForCall (ooCallData *call, struct ast_codec_pref *prefs) |
| int | reload_config (void) |
| int | restart_monitor (void) |
| Start the channel monitor thread. | |
| void | setup_rtp_connection (ooCallData *call, const char *remoteIp, int remotePort) |
| int | update_our_aliases (ooCallData *call, struct ooh323_pvt *p) |
| void close_rtp_connection | ( | ooCallData * | call | ) |
Definition at line 3212 of file chan_ooh323.c.
References ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_rtp_stop(), ast_verbose(), find_call(), gH323Debug, ooh323_pvt::lock, LOG_ERROR, and ooh323_pvt::rtp.
Referenced by ooh323c_stop_transmit_channel().
03213 { 03214 struct ooh323_pvt *p = NULL; 03215 03216 if(gH323Debug) 03217 ast_verbose("--- close_rtp_connection\n"); 03218 03219 p = find_call(call); 03220 if(!p) 03221 { 03222 ast_log(LOG_ERROR, "Couldn't find matching call to close rtp " 03223 "connection\n"); 03224 return; 03225 } 03226 ast_mutex_lock(&p->lock); 03227 if(p->rtp){ 03228 ast_rtp_stop(p->rtp); 03229 } 03230 ast_mutex_unlock(&p->lock); 03231 03232 if(gH323Debug) 03233 ast_verbose("+++ close_rtp_connection\n"); 03234 03235 return; 03236 }
| int configure_local_rtp | ( | struct ooh323_pvt * | p, | |
| ooCallData * | call | |||
| ) |
Definition at line 3143 of file chan_ooh323.c.
References ast_codec_pref_index(), ast_inet_ntoa(), ast_rtp_codec_setpref(), ast_rtp_get_us(), ast_verbose(), format, gH323Debug, ooh323_convertAsteriskCapToH323Cap(), ooh323_pvt::prefs, and ooh323_pvt::rtp.
Referenced by onNewCallCreated(), and ooh323_onReceivedSetup().
03144 { 03145 struct sockaddr_in us; 03146 ooMediaInfo mediaInfo; 03147 int x, format=0; 03148 03149 if(gH323Debug) 03150 ast_verbose("--- configure_local_rtp\n"); 03151 03152 if (p->rtp){ 03153 ast_rtp_codec_setpref(p->rtp, &p->prefs); 03154 } 03155 03156 /* figure out our local RTP port and tell the H.323 stack about it*/ 03157 ast_rtp_get_us(p->rtp, &us); 03158 03159 strncpy(mediaInfo.lMediaIP, ast_inet_ntoa(us.sin_addr), sizeof(mediaInfo.lMediaIP)-1); 03160 mediaInfo.lMediaPort = ntohs(us.sin_port); 03161 mediaInfo.lMediaCntrlPort = mediaInfo.lMediaPort +1; 03162 for(x=0; 0 != (format=ast_codec_pref_index(&p->prefs, x)); x++) 03163 { 03164 strcpy(mediaInfo.dir, "transmit"); 03165 mediaInfo.cap = ooh323_convertAsteriskCapToH323Cap(format); 03166 ooAddMediaInfo(call, mediaInfo); 03167 strcpy(mediaInfo.dir, "receive"); 03168 ooAddMediaInfo(call, mediaInfo); 03169 if(mediaInfo.cap == OO_G729A) { 03170 strcpy(mediaInfo.dir, "transmit"); 03171 mediaInfo.cap = OO_G729; 03172 ooAddMediaInfo(call, mediaInfo); 03173 strcpy(mediaInfo.dir, "receive"); 03174 ooAddMediaInfo(call, mediaInfo); 03175 } 03176 } 03177 03178 if(gH323Debug) 03179 ast_verbose("+++ configure_local_rtp\n"); 03180 03181 return 1; 03182 }
| int delete_peers | ( | void | ) |
Definition at line 2862 of file chan_ooh323.c.
References ast_mutex_destroy(), ast_mutex_lock(), ast_mutex_unlock(), free, ast_peer_list::lock, ooh323_peer::next, peerl, and ast_peer_list::peers.
Referenced by ooh323_do_reload(), and unload_module().
02863 { 02864 struct ooh323_peer *cur=NULL, *prev=NULL; 02865 ast_mutex_lock(&peerl.lock); 02866 cur = peerl.peers; 02867 while(cur) 02868 { 02869 prev = cur; 02870 cur = cur->next; 02871 02872 ast_mutex_destroy(&prev->lock); 02873 if(prev->h323id) free(prev->h323id); 02874 if(prev->email) free(prev->email); 02875 if(prev->url) free(prev->url); 02876 if(prev->e164) free(prev->e164); 02877 free(prev); 02878 02879 if(cur == peerl.peers) { break; } 02880 } 02881 peerl.peers = NULL; 02882 ast_mutex_unlock(&peerl.lock); 02883 return 0; 02884 }
| int delete_users | ( | void | ) |
Definition at line 2886 of file chan_ooh323.c.
References ast_mutex_destroy(), ast_mutex_lock(), ast_mutex_unlock(), free, ast_user_list::lock, ooh323_user::next, userl, and ast_user_list::users.
02887 { 02888 struct ooh323_user *cur=NULL, *prev=NULL; 02889 ast_mutex_lock(&userl.lock); 02890 cur = userl.users; 02891 while(cur) 02892 { 02893 prev = cur; 02894 cur = cur->next; 02895 ast_mutex_destroy(&prev->lock); 02896 free(prev); 02897 if(cur == userl.users) { break; } 02898 } 02899 userl.users = NULL; 02900 ast_mutex_unlock(&userl.lock); 02901 return 0; 02902 }
| struct ooh323_peer* find_peer | ( | const char * | name, | |
| int | port | |||
| ) | [read] |
Definition at line 677 of file chan_ooh323.c.
References ast_mutex_lock(), ast_mutex_unlock(), ast_verbose(), ooh323_peer::e164, gH323Debug, ooh323_peer::h323id, ooh323_peer::ip, ast_peer_list::lock, ooh323_peer::name, ooh323_peer::next, peerl, and ast_peer_list::peers.
00678 { 00679 struct ooh323_peer *peer=NULL; 00680 00681 if(gH323Debug) 00682 ast_verbose("--- find_peer \"%s\"\n", name); 00683 00684 00685 peer = peerl.peers; 00686 ast_mutex_lock(&peerl.lock); 00687 while(peer) 00688 { 00689 if(gH323Debug) { 00690 ast_verbose(" comparing with \"%s\"\n", peer->ip); 00691 } 00692 if(!strcasecmp(peer->name, name)) 00693 break; 00694 if(peer->h323id && !strcasecmp(peer->h323id, name)) 00695 break; 00696 if(peer->e164 && !strcasecmp(peer->e164, name)) 00697 break; 00698 /* 00699 if(!strcmp(peer->ip, name)) { 00700 if(port > 0 && peer->port == port) { break; } 00701 else if (port <= 0) { break; } 00702 } 00703 */ 00704 peer = peer->next; 00705 } 00706 ast_mutex_unlock(&peerl.lock); 00707 00708 if(gH323Debug) { 00709 if(peer) { 00710 ast_verbose(" found matching peer\n"); 00711 } 00712 ast_verbose("+++ find_peer \"%s\"\n", name); 00713 } 00714 00715 return peer; 00716 }
| struct ooh323_user* find_user | ( | const char * | name, | |
| const char * | ip | |||
| ) | [read] |
Definition at line 616 of file chan_ooh323.c.
References ast_mutex_lock(), ast_mutex_unlock(), ast_verbose(), gH323Debug, ast_user_list::lock, ooh323_user::mIP, ooh323_user::mUseIP, ooh323_user::name, ooh323_user::next, userl, and ast_user_list::users.
00617 { 00618 struct ooh323_user *user=NULL; 00619 00620 if(gH323Debug) 00621 ast_verbose("--- find_user \n"); 00622 00623 user = userl.users; 00624 ast_mutex_lock(&userl.lock); 00625 while(user) 00626 { 00627 if(ip && user->mUseIP && !strcmp(user->mIP, ip)) { 00628 break; 00629 } 00630 if(name && !strcmp(user->name, name)) { 00631 break; 00632 } 00633 user = user->next; 00634 } 00635 ast_mutex_unlock(&userl.lock); 00636 00637 if(gH323Debug) 00638 ast_verbose("+++ find_user\n"); 00639 00640 return user; 00641 }
| int ooh323_convert_hangupcause_asteriskToH323 | ( | int | cause | ) |
Definition at line 3325 of file chan_ooh323.c.
References AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, AST_CAUSE_BUSY, AST_CAUSE_CALL_REJECTED, AST_CAUSE_CONGESTION, AST_CAUSE_FAILURE, AST_CAUSE_NO_ANSWER, AST_CAUSE_NORMAL, and AST_CAUSE_UNALLOCATED.
Referenced by ooh323_hangup().
03326 { 03327 switch(cause) 03328 { 03329 case AST_CAUSE_CALL_REJECTED: 03330 return OO_REASON_REMOTE_REJECTED; 03331 case AST_CAUSE_UNALLOCATED: 03332 return OO_REASON_NOUSER; 03333 case AST_CAUSE_BUSY: 03334 return OO_REASON_REMOTE_BUSY; 03335 case AST_CAUSE_BEARERCAPABILITY_NOTAVAIL: 03336 return OO_REASON_NOCOMMON_CAPABILITIES; 03337 case AST_CAUSE_CONGESTION: 03338 return OO_REASON_REMOTE_BUSY; 03339 case AST_CAUSE_NO_ANSWER: 03340 return OO_REASON_REMOTE_NOANSWER; 03341 case AST_CAUSE_NORMAL: 03342 return OO_REASON_REMOTE_CLEARED; 03343 case AST_CAUSE_FAILURE: 03344 default: 03345 return OO_REASON_UNKNOWN; 03346 } 03347 03348 return 0; 03349 03350 03351 }
| int ooh323_convert_hangupcause_h323ToAsterisk | ( | int | cause | ) |
Definition at line 3353 of file chan_ooh323.c.
References AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, AST_CAUSE_BUSY, AST_CAUSE_CALL_REJECTED, AST_CAUSE_CONGESTION, AST_CAUSE_FAILURE, AST_CAUSE_NO_ANSWER, AST_CAUSE_NORMAL, and AST_CAUSE_UNALLOCATED.
Referenced by onCallCleared().
03354 { 03355 switch(cause) { 03356 case OO_REASON_REMOTE_REJECTED: 03357 return AST_CAUSE_CALL_REJECTED; 03358 case OO_REASON_NOUSER: 03359 return AST_CAUSE_UNALLOCATED; 03360 case OO_REASON_REMOTE_BUSY: 03361 case OO_REASON_LOCAL_BUSY: 03362 return AST_CAUSE_BUSY; 03363 case OO_REASON_NOCOMMON_CAPABILITIES: /* No codecs approved */ 03364 return AST_CAUSE_BEARERCAPABILITY_NOTAVAIL; 03365 case OO_REASON_REMOTE_CONGESTED: 03366 case OO_REASON_LOCAL_CONGESTED: 03367 return AST_CAUSE_CONGESTION; 03368 case OO_REASON_REMOTE_NOANSWER: 03369 return AST_CAUSE_NO_ANSWER; 03370 case OO_REASON_UNKNOWN: 03371 case OO_REASON_INVALIDMESSAGE: 03372 case OO_REASON_TRANSPORTFAILURE: 03373 return AST_CAUSE_FAILURE; 03374 case OO_REASON_REMOTE_CLEARED: 03375 return AST_CAUSE_NORMAL; 03376 default: 03377 return AST_CAUSE_NORMAL; 03378 } 03379 /* Never reached */ 03380 return 0; 03381 }
| int ooh323_convertAsteriskCapToH323Cap | ( | int | cap | ) |
Definition at line 3089 of file chan_ooh323.c.
References AST_FORMAT_ALAW, AST_FORMAT_G723_1, AST_FORMAT_G729A, AST_FORMAT_GSM, AST_FORMAT_H263, AST_FORMAT_ULAW, ast_getformatname_multiple(), ast_log(), and LOG_NOTICE.
Referenced by configure_local_rtp(), ooh323_set_rtp_peer(), and ooh323_update_capPrefsOrderForCall().
03090 { 03091 char formats[512]; 03092 switch (cap) { 03093 case AST_FORMAT_ULAW: 03094 return OO_G711ULAW64K; 03095 case AST_FORMAT_ALAW: 03096 return OO_G711ALAW64K; 03097 case AST_FORMAT_GSM: 03098 return OO_GSMFULLRATE; 03099 case AST_FORMAT_G729A: 03100 return OO_G729A; 03101 case AST_FORMAT_G723_1: 03102 return OO_G7231; 03103 case AST_FORMAT_H263: 03104 return OO_H263VIDEO; 03105 default: 03106 ast_log(LOG_NOTICE, "Don't know how to deal with mode %s\n", 03107 ast_getformatname_multiple(formats,512,cap)); 03108 return -1; 03109 } 03110 }
| void ooh323_delete_peer | ( | struct ooh323_peer * | peer | ) |
Definition at line 1591 of file chan_ooh323.c.
References ast_mutex_lock(), ast_mutex_unlock(), ast_verbose(), ooh323_peer::e164, ooh323_peer::email, free, gH323Debug, ooh323_peer::h323id, ast_peer_list::lock, ooh323_peer::next, peerl, ast_peer_list::peers, and ooh323_peer::url.
Referenced by build_peer().
01592 { 01593 struct ooh323_peer *prev=NULL, *cur=NULL; 01594 01595 if(gH323Debug) 01596 ast_verbose("--- ooh323_delete_peer\n"); 01597 01598 if(peer) 01599 { 01600 cur = peerl.peers; 01601 ast_mutex_lock(&peerl.lock); 01602 while(cur) 01603 { 01604 if(cur==peer) break; 01605 prev = cur; 01606 cur = cur->next; 01607 } 01608 01609 if(cur) 01610 { 01611 if(prev) 01612 prev->next = cur->next; 01613 else 01614 peerl.peers = cur->next; 01615 } 01616 ast_mutex_unlock(&peerl.lock); 01617 01618 if(peer->h323id) free(peer->h323id); 01619 if(peer->email) free(peer->email); 01620 if(peer->url) free(peer->url); 01621 if(peer->e164) free(peer->e164); 01622 01623 free(peer); 01624 } 01625 01626 if(gH323Debug) 01627 ast_verbose("+++ ooh323_delete_peer\n"); 01628 01629 }
| int ooh323_destroy | ( | struct ooh323_pvt * | p | ) |
Definition at line 2770 of file chan_ooh323.c.
References ast_dsp_free(), ast_log(), ast_mutex_destroy(), ast_mutex_lock(), ast_mutex_trylock(), ast_mutex_unlock(), ast_rtp_destroy(), ast_verbose(), free, gH323Debug, iflist, LOG_DEBUG, dahdi_pvt::next, ooh323_pvt::next, and ooh323_pvt::username.
Referenced by do_monitor(), ooh323_request(), and unload_module().
02771 { 02772 /* NOTE: Assumes iflock already acquired */ 02773 struct ooh323_pvt *prev=NULL,*cur = NULL; 02774 02775 02776 if(gH323Debug) 02777 { 02778 ast_verbose("--- ooh323_destroy \n"); 02779 02780 if(p) 02781 ast_verbose(" Destroying %s\n", p->username); 02782 } 02783 02784 cur = iflist; 02785 while(cur) 02786 { 02787 if(cur == p) { break; } 02788 prev = cur; 02789 cur = cur->next; 02790 } 02791 02792 if(cur) 02793 { 02794 ast_mutex_lock(&cur->lock); 02795 if(prev) 02796 prev->next = cur->next; 02797 else 02798 iflist = cur->next; 02799 02800 if(cur->callToken) { 02801 free(cur->callToken); 02802 cur->callToken = 0; 02803 } 02804 02805 if(cur->username) { 02806 free(cur->username); 02807 cur->username = 0; 02808 } 02809 02810 if(cur->host) { 02811 free(cur->host); 02812 cur->host = 0; 02813 } 02814 02815 if(cur->callerid_name) { 02816 free(cur->callerid_name); 02817 cur->callerid_name = 0; 02818 } 02819 02820 if(cur->callerid_num) { 02821 free(cur->callerid_num); 02822 cur->callerid_num = 0; 02823 } 02824 02825 02826 if (cur->rtp) { 02827 ast_rtp_destroy(cur->rtp); 02828 cur->rtp = 0; 02829 } 02830 02831 /* Unlink us from the owner if we have one */ 02832 if (cur->owner) { 02833 while(ast_mutex_trylock(&cur->owner->lock)) 02834 { 02835 ast_log(LOG_DEBUG,"Failed to grab lock, trying again\n"); 02836 ast_mutex_unlock(&cur->lock); 02837 usleep(1); 02838 ast_mutex_lock(&cur->lock); 02839 } 02840 ast_log(LOG_DEBUG, "Detaching from %s\n", cur->owner->name); 02841 cur->owner->tech_pvt = NULL; 02842 ast_mutex_unlock(&cur->owner->lock); 02843 cur->owner = NULL; 02844 } 02845 02846 if (cur->vad) { 02847 ast_dsp_free(cur->vad); 02848 cur->vad = NULL; 02849 } 02850 ast_mutex_unlock(&cur->lock); 02851 ast_mutex_destroy(&cur->lock); 02852 02853 free(cur); 02854 } 02855 02856 if(gH323Debug) 02857 ast_verbose("+++ ooh323_destroy\n"); 02858 02859 return 0; 02860 }
| int ooh323_onReceivedDigit | ( | OOH323CallData * | call, | |
| const char * | digit | |||
| ) |
Callback for sending digits from H.323 up to asterisk
Definition at line 1213 of file chan_ooh323.c.
References AST_FRAME_DTMF, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_queue_frame(), ast_frame::data, ast_frame::datalen, find_call(), ast_frame::frametype, ooh323_pvt::lock, LOG_DEBUG, LOG_ERROR, ast_frame::mallocd, ast_frame::offset, ooh323_pvt::owner, ast_frame::samples, ast_frame::src, and ast_frame::subclass.
Referenced by load_module().
01214 { 01215 struct ooh323_pvt *p=NULL; 01216 struct ast_frame f; 01217 int res; 01218 01219 ast_log(LOG_DEBUG, "Received Digit: %c\n", digit); 01220 p = find_call(call); 01221 if(!p) { 01222 ast_log(LOG_ERROR, "Failed to find a matching call.\n"); 01223 return -1; 01224 } 01225 if(!p->owner) { 01226 ast_log(LOG_ERROR, "Channel has no owner\n"); 01227 return -1; 01228 } 01229 ast_mutex_lock(&p->lock); 01230 memset(&f, 0, sizeof(f)); 01231 f.frametype = AST_FRAME_DTMF; 01232 f.subclass = digit[0]; 01233 f.datalen = 0; 01234 f.samples = 800; 01235 f.offset = 0; 01236 f.data = NULL; 01237 f.mallocd = 0; 01238 f.src = "SEND_DIGIT"; 01239 ast_mutex_unlock(&p->lock); 01240 res = ast_queue_frame(p->owner, &f); 01241 return res; 01242 }
| int ooh323_onReceivedSetup | ( | ooCallData * | call, | |
| Q931Message * | pmsg | |||
| ) |
Definition at line 1244 of file chan_ooh323.c.
References ooh323_user::accountcode, ooh323_pvt::accountcode, ooh323_user::amaflags, ooh323_pvt::amaflags, ast_clear_flag, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_strlen_zero(), ast_verbose(), ooh323_pvt::callee_dialedDigits, ooh323_pvt::callee_email, ooh323_pvt::callee_h323id, ooh323_pvt::caller_dialedDigits, ooh323_pvt::caller_email, ooh323_pvt::caller_h323id, ooh323_pvt::caller_url, ooh323_pvt::callerid_name, ooh323_pvt::callerid_num, ooh323_user::capability, ooh323_pvt::capability, configure_local_rtp(), ooh323_user::context, ooh323_pvt::context, ooh323_user::dtmfmode, ooh323_pvt::dtmfmode, ooh323_pvt::exten, find_user(), ooh323_pvt::flags, gH323Debug, H323_DISABLEGK, H323_OUTGOING, ooh323_user::lock, ooh323_pvt::lock, LOG_ERROR, ooh323_user::name, ooh323_alloc(), ooh323c_set_capability_for_call(), ooh323_user::prefs, ooh323_pvt::prefs, strdup, update_our_aliases(), and ooh323_pvt::username.
Referenced by load_module().
01245 { 01246 struct ooh323_pvt *p=NULL; 01247 struct ooh323_user *user=NULL; 01248 ooAliases *alias=NULL; 01249 char *at=NULL; 01250 char number [OO_MAX_NUMBER_LENGTH]; 01251 01252 if(gH323Debug) 01253 ast_verbose("--- ooh323_onReceivedSetup %s\n", call->callToken); 01254 01255 01256 p = ooh323_alloc(call->callReference, call->callToken); 01257 if(!p) 01258 { 01259 ast_log(LOG_ERROR, "Failed to create a new call.\n"); 01260 return -1; 01261 } 01262 ast_mutex_lock(&p->lock); 01263 ast_clear_flag(p, H323_OUTGOING); 01264 01265 01266 if(call->remoteDisplayName){ 01267 p->callerid_name = strdup(call->remoteDisplayName); 01268 } 01269 01270 if(ooCallGetCallingPartyNumber(call, number, OO_MAX_NUMBER_LENGTH) == OO_OK) 01271 { 01272 p->callerid_num = strdup(number); 01273 } 01274 01275 if(call->remoteAliases) 01276 { 01277 alias = call->remoteAliases; 01278 while(alias) 01279 { 01280 if(alias->type == T_H225AliasAddress_h323_ID) 01281 { 01282 if(!p->callerid_name){ 01283 p->callerid_name = strdup(alias->value); 01284 } 01285 strncpy(p->caller_h323id, alias->value, sizeof(p->caller_h323id)-1); 01286 } 01287 else if(alias->type == T_H225AliasAddress_dialedDigits) 01288 { 01289 if(!p->callerid_num) 01290 p->callerid_num = strdup(alias->value); 01291 strncpy(p->caller_dialedDigits, alias->value, 01292 sizeof(p->caller_dialedDigits)-1); 01293 } 01294 else if(alias->type == T_H225AliasAddress_email_ID) 01295 { 01296 strncpy(p->caller_email, alias->value, sizeof(p->caller_email)-1); 01297 } 01298 else if(alias->type == T_H225AliasAddress_url_ID) 01299 { 01300 strncpy(p->caller_url, alias->value, sizeof(p->caller_url)-1); 01301 } 01302 alias = alias->next; 01303 } 01304 } 01305 01306 number[0]='\0'; 01307 if(ooCallGetCalledPartyNumber(call, number, OO_MAX_NUMBER_LENGTH)== OO_OK) 01308 { 01309 strncpy(p->exten, number, sizeof(p->exten)-1); 01310 } 01311 else{ 01312 update_our_aliases(call, p); 01313 if(!ast_strlen_zero(p->callee_dialedDigits)){ 01314 strncpy(p->exten, p->callee_dialedDigits, sizeof(p->exten)-1); 01315 } 01316 else if(!ast_strlen_zero(p->callee_h323id)){ 01317 strncpy(p->exten, p->callee_h323id, sizeof(p->exten)-1); 01318 } 01319 else if(!ast_strlen_zero(p->callee_email)){ 01320 strncpy(p->exten, p->callee_email, sizeof(p->exten)-1); 01321 if((at=strchr(p->exten, '@'))) { 01322 *at='\0'; 01323 } 01324 } 01325 } 01326 01327 /* if no extension found, set to default 's' */ 01328 if(ast_strlen_zero(p->exten)) 01329 { 01330 p->exten[0]='s'; 01331 p->exten[1]='\0'; 01332 } 01333 01334 if(!p->callerid_name) 01335 { 01336 p->callerid_name = strdup(call->remoteIP); 01337 } 01338 01339 if(p->callerid_name) 01340 { 01341 user = find_user(p->callerid_name, call->remoteIP); 01342 if(user) 01343 { 01344 ast_mutex_lock(&user->lock); 01345 p->username = strdup(user->name); 01346 strncpy(p->context, user->context, sizeof(p->context)-1); 01347 strncpy(p->accountcode, user->accountcode, sizeof(p->accountcode)-1); 01348 p->amaflags = user->amaflags; 01349 p->capability = user->capability; 01350 memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref)); 01351 p->dtmfmode = user->dtmfmode; 01352 /* Since, call is coming from a pbx user, no need to use gk */ 01353 OO_SETFLAG(p->flags, H323_DISABLEGK); 01354 OO_SETFLAG(call->flags, OO_M_DISABLEGK); 01355 ast_mutex_unlock(&user->lock); 01356 } 01357 } 01358 01359 01360 ooh323c_set_capability_for_call(call, &p->prefs, p->capability,p->dtmfmode); 01361 configure_local_rtp(p, call); 01362 01363 ast_mutex_unlock(&p->lock); 01364 01365 if(gH323Debug) 01366 ast_verbose("+++ ooh323_onReceivedSetup - Determined context %s, " 01367 "extension %s\n", p->context, p->exten); 01368 01369 return OO_OK; 01370 }
| struct ast_frame* ooh323_rtp_read | ( | struct ast_channel * | ast, | |
| struct ooh323_pvt * | p | |||
| ) | [read] |
Definition at line 3276 of file chan_ooh323.c.
References ast_dsp_process(), AST_FRAME_DTMF, AST_FRAME_NULL, AST_FRAME_VOICE, ast_log(), ast_rtcp_read(), ast_rtp_read(), ast_set_read_format(), ast_set_write_format(), ooh323_pvt::dtmfmode, f, ast_channel::fdno, ast_frame::frametype, H323_DTMF_INBAND, H323_DTMF_RFC2833, LOG_DEBUG, ast_channel::nativeformats, ooh323_pvt::owner, ast_channel::readformat, ooh323_pvt::rtp, ast_frame::subclass, ooh323_pvt::vad, ooh323_pvt::vrtp, and ast_channel::writeformat.
Referenced by ooh323_read().
03277 { 03278 /* Retrieve audio/etc from channel. Assumes p->lock is already held. */ 03279 struct ast_frame *f; 03280 static struct ast_frame null_frame = { AST_FRAME_NULL, }; 03281 switch(ast->fdno) { 03282 case 0: 03283 f = ast_rtp_read(p->rtp); /* RTP Audio */ 03284 break; 03285 case 1: 03286 f = ast_rtcp_read(p->rtp); /* RTCP Control Channel */ 03287 break; 03288 case 2: 03289 f = ast_rtp_read(p->vrtp); /* RTP Video */ 03290 break; 03291 case 3: 03292 f = ast_rtcp_read(p->vrtp); /* RTCP Control Channel for video */ 03293 break; 03294 default: 03295 f = &null_frame; 03296 } 03297 /* Don't send RFC2833 if we're not supposed to */ 03298 if (f && (f->frametype == AST_FRAME_DTMF) && 03299 !(p->dtmfmode & H323_DTMF_RFC2833)) 03300 return &null_frame; 03301 if (p->owner) 03302 { 03303 /* We already hold the channel lock */ 03304 if (f->frametype == AST_FRAME_VOICE) 03305 { 03306 if (f->subclass != p->owner->nativeformats) 03307 { 03308 ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass); 03309 p->owner->nativeformats = f->subclass; 03310 ast_set_read_format(p->owner, p->owner->readformat); 03311 ast_set_write_format(p->owner, p->owner->writeformat); 03312 } 03313 if ((p->dtmfmode & H323_DTMF_INBAND) && p->vad) 03314 { 03315 f = ast_dsp_process(p->owner, p->vad, f); 03316 if (f && (f->frametype == AST_FRAME_DTMF)) 03317 ast_log(LOG_DEBUG, "* Detected inband DTMF '%c'\n",f->subclass); 03318 } 03319 } 03320 } 03321 return f; 03322 }
| void ooh323_set_read_format | ( | ooCallData * | call, | |
| int | fmt | |||
| ) |
Definition at line 1133 of file chan_ooh323.c.
References ast_getformatname_multiple(), ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_set_read_format(), find_call(), ooh323_pvt::lock, LOG_ERROR, ooh323_pvt::owner, and ooh323_pvt::readformat.
Referenced by ooh323c_start_receive_channel().
01134 { 01135 #if 0 01136 struct ooh323_pvt *p = NULL; 01137 char formats[512]; 01138 #ifdef print_debug 01139 printf("--- ooh323_update_readformat %s\n", 01140 ast_getformatname_multiple(formats,512, fmt)); 01141 #endif 01142 01143 p = find_call(call); 01144 if(!p) 01145 { 01146 ast_log(LOG_ERROR, "No matching call found for %s\n", call->callToken); 01147 return; 01148 } 01149 01150 ast_mutex_lock(&p->lock); 01151 p->readformat = fmt; 01152 ast_mutex_unlock(&p->lock); 01153 ast_set_read_format(p->owner, fmt); 01154 01155 #ifdef print_debug 01156 printf("+++ ooh323_update_readformat\n"); 01157 #endif 01158 #endif 01159 }
| void ooh323_set_write_format | ( | ooCallData * | call, | |
| int | fmt | |||
| ) |
Definition at line 1095 of file chan_ooh323.c.
References ast_getformatname_multiple(), ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_set_write_format(), find_call(), ooh323_pvt::lock, LOG_ERROR, ooh323_pvt::owner, ast_channel::writeformat, and ooh323_pvt::writeformat.
Referenced by ooh323c_start_transmit_channel().
01096 { 01097 #if 0 01098 struct ooh323_pvt *p = NULL; 01099 char formats[512]; 01100 #ifdef print_debug 01101 printf("--- ooh323_update_writeformat %s\n", 01102 ast_getformatname_multiple(formats,512, fmt)); 01103 #endif 01104 01105 p = find_call(call); 01106 if(!p) 01107 { 01108 ast_log(LOG_ERROR, "No matching call found for %s\n", call->callToken); 01109 return; 01110 } 01111 01112 ast_mutex_lock(&p->lock); 01113 01114 p->writeformat = fmt; 01115 ast_mutex_unlock(&p->lock); 01116 01117 if(p->owner){ 01118 printf("Writeformat before update %s\n", 01119 ast_getformatname_multiple(formats,512, p->owner->writeformat)); 01120 ast_set_write_format(p->owner, fmt); 01121 } 01122 else 01123 ast_log(LOG_ERROR, "No owner found\n"); 01124 01125 01126 #ifdef print_debug 01127 printf("+++ ooh323_update_writeformat\n"); 01128 #endif 01129 #endif 01130 }
| int ooh323_update_capPrefsOrderForCall | ( | ooCallData * | call, | |
| struct ast_codec_pref * | prefs | |||
| ) |
Definition at line 3073 of file chan_ooh323.c.
References ast_codec_pref_index(), and ooh323_convertAsteriskCapToH323Cap().
03074 { 03075 int i=0; 03076 int codec = ast_codec_pref_index(prefs, i); 03077 03078 ooResetCapPrefs(call); 03079 while(codec) 03080 { 03081 ooAppendCapToCapPrefs(call, ooh323_convertAsteriskCapToH323Cap(codec)); 03082 codec = ast_codec_pref_index(prefs, ++i); 03083 } 03084 03085 return 0; 03086 }
| int reload_config | ( | void | ) |
Definition at line 1876 of file chan_ooh323.c.
References ast_category_browse(), ast_cdr_amaflags2int(), ast_config_destroy(), ast_config_load(), AST_FORMAT_ULAW, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_parse_allow_disallow(), ast_true(), ast_variable_browse(), ast_variable_retrieve(), ast_verbose(), build_peer(), build_user(), config, DEFAULT_CONTEXT, DEFAULT_H323ACCNT, DEFAULT_H323ID, DEFAULT_LOGFILE, format, gAccountcode, gAliasList, gAMAFLAGS, gCallerID, gCapability, gContext, gDTMFMode, gFastStart, gGatekeeper, gH323Debug, gIncomingLimit, gIP, gIsGateway, gLogFile, gMediaWaitForConnect, gOutgoingLimit, gPort, gPrefs, gRasGkMode, gRTPTimeout, gTOS, gTunneling, H323_DTMF_H245ALPHANUMERIC, H323_DTMF_H245SIGNAL, H323_DTMF_INBAND, H323_DTMF_Q931, H323_DTMF_RFC2833, IPTOS_MINCOST, ast_variable::lineno, ast_peer_list::lock, ast_user_list::lock, LOG_ERROR, LOG_NOTICE, LOG_WARNING, malloc, ooh323_config::mTCPPortEnd, ooh323_config::mTCPPortStart, ast_variable::name, ooh323_peer::next, ooh323_user::next, ast_variable::next, ooconfig, peerl, ast_peer_list::peers, strdup, userl, ast_user_list::users, ast_variable::value, and VERBOSE_PREFIX_3.
01877 { 01878 int format; 01879 struct ooAliases *pNewAlias = NULL; 01880 struct ast_config *cfg; 01881 struct ast_variable *v; 01882 struct ooh323_user *user = NULL; 01883 struct ooh323_peer *peer = NULL; 01884 char *cat; 01885 const char *utype; 01886 01887 if(gH323Debug) 01888 ast_verbose("--- reload_config\n"); 01889 01890 cfg = ast_config_load((char*)config); 01891 01892 /* We *must* have a config file otherwise stop immediately */ 01893 if (!cfg) { 01894 ast_log(LOG_NOTICE, "Unable to load config %s, OOH323 disabled\n",config); 01895 return 1; 01896 } 01897 01898 /* Inintialize everything to default */ 01899 strcpy(gLogFile, DEFAULT_LOGFILE); 01900 gPort = 1720; 01901 gIP[0]='\0'; 01902 strcpy(gCallerID, DEFAULT_H323ID); 01903 gCapability = AST_FORMAT_ULAW; 01904 memset(&gPrefs, 0, sizeof(struct ast_codec_pref)); 01905 gDTMFMode = H323_DTMF_RFC2833; 01906 gRasGkMode = RasNoGatekeeper; 01907 gGatekeeper[0] = '\0'; 01908 gRTPTimeout = 60; 01909 strcpy(gAccountcode, DEFAULT_H323ACCNT); 01910 gFastStart = 1; 01911 gTunneling = 1; 01912 gTOS = 0; 01913 strcpy(gContext, DEFAULT_CONTEXT); 01914 gAliasList = NULL; 01915 gMediaWaitForConnect = 0; 01916 ooconfig.mTCPPortStart = 12030; 01917 ooconfig.mTCPPortEnd = 12230; 01918 01919 v = ast_variable_browse(cfg, "general"); 01920 while(v) { 01921 01922 if (!strcasecmp(v->name, "port")) { 01923 gPort = (int)strtol(v->value, NULL, 10); 01924 } 01925 else if (!strcasecmp(v->name, "bindaddr")) { 01926 strncpy(gIP, v->value, sizeof(gIP)-1); 01927 } 01928 else if (!strcasecmp(v->name, "h225portrange")) { 01929 char* endlimit = 0; 01930 char temp[512]; 01931 strncpy(temp, v->value, sizeof(temp) - 1); 01932 /* char *temp = ast_strdupa(v->value); */ 01933 endlimit = strchr(temp, ','); 01934 if (endlimit) { 01935 *endlimit = '\0'; 01936 endlimit++; 01937 ooconfig.mTCPPortStart = atoi(temp); 01938 ooconfig.mTCPPortEnd = atoi(endlimit); 01939 01940 if(ooH323EpSetTCPPortRange(ooconfig.mTCPPortStart, 01941 ooconfig.mTCPPortEnd) == OO_FAILED) { 01942 ast_log(LOG_ERROR, "h225portrange: Failed to set range\n"); 01943 } 01944 } 01945 else { 01946 ast_log(LOG_ERROR, "h225portrange: Invalid format, separate port range with \",\"\n"); 01947 } 01948 } 01949 else if (!strcasecmp(v->name, "gateway")) { 01950 gIsGateway = ast_true(v->value); 01951 } 01952 else if (!strcasecmp(v->name, "faststart")) { 01953 gFastStart = ast_true(v->value); 01954 if(gFastStart) 01955 ooH323EpEnableFastStart(); 01956 else 01957 ooH323EpDisableFastStart(); 01958 } 01959 else if (!strcasecmp(v->name, "mediawaitforconnect")) { 01960 gMediaWaitForConnect = ast_true(v->value); 01961 if(gMediaWaitForConnect) 01962 ooH323EpEnableMediaWaitForConnect(); 01963 else 01964 ooH323EpDisableMediaWaitForConnect(); 01965 } 01966 else if (!strcasecmp(v->name, "h245tunneling")) { 01967 gTunneling = ast_true(v->value); 01968 if(gTunneling) 01969 ooH323EpEnableH245Tunneling(); 01970 else 01971 ooH323EpDisableH245Tunneling(); 01972 } 01973 else if (!strcasecmp(v->name, "h323id")) { 01974 pNewAlias = malloc(sizeof(struct ooAliases)); 01975 if(!pNewAlias){ 01976 ast_log(LOG_ERROR, "Failed to allocate memory for h323id alias\n"); 01977 return 1; 01978 } 01979 pNewAlias->type = T_H225AliasAddress_h323_ID; 01980 pNewAlias->value = strdup(v->value); 01981 pNewAlias->next = gAliasList; 01982 gAliasList = pNewAlias; 01983 pNewAlias = NULL; 01984 } 01985 else if (!strcasecmp(v->name, "e164")) { 01986 pNewAlias = malloc(sizeof(struct ooAliases)); 01987 if(!pNewAlias){ 01988 ast_log(LOG_ERROR, "Failed to allocate memory for e164 alias\n"); 01989 return 1; 01990 } 01991 pNewAlias->type = T_H225AliasAddress_dialedDigits; 01992 pNewAlias->value = strdup(v->value); 01993 pNewAlias->next = gAliasList; 01994 gAliasList = pNewAlias; 01995 pNewAlias = NULL; 01996 } 01997 else if (!strcasecmp(v->name, "email")) { 01998 pNewAlias = malloc(sizeof(struct ooAliases)); 01999 if(!pNewAlias){ 02000 ast_log(LOG_ERROR, "Failed to allocate memory for email alias\n"); 02001 return 1; 02002 } 02003 pNewAlias->type = T_H225AliasAddress_email_ID; 02004 pNewAlias->value = strdup(v->value); 02005 pNewAlias->next = gAliasList; 02006 gAliasList = pNewAlias; 02007 pNewAlias = NULL; 02008 } 02009 else if (!strcasecmp(v->name, "callerid")) { 02010 strncpy(gCallerID, v->value, sizeof(gCallerID)-1); 02011 } 02012 else if (!strcasecmp(v->name, "incominglimit")) { 02013 gIncomingLimit = atoi(v->value); 02014 } 02015 else if (!strcasecmp(v->name, "outgoinglimit")) { 02016 gOutgoingLimit = atoi(v->value); 02017 } 02018 else if (!strcasecmp(v->name, "gatekeeper")) { 02019 if (!strcasecmp(v->value, "DISABLE")) { 02020 gRasGkMode = RasNoGatekeeper; 02021 } 02022 else if (!strcasecmp(v->value, "DISCOVER")) { 02023 gRasGkMode = RasDiscoverGatekeeper; 02024 } 02025 else { 02026 gRasGkMode = RasUseSpecificGatekeeper; 02027 strncpy(gGatekeeper, v->value, sizeof(gGatekeeper)-1); 02028 } 02029 } 02030 else if (!strcasecmp(v->name, "logfile")) { 02031 strncpy(gLogFile, v->value, sizeof(gLogFile)-1); 02032 } 02033 else if (!strcasecmp(v->name, "context")) { 02034 strncpy(gContext, v->value, sizeof(gContext)-1); 02035 ast_verbose(VERBOSE_PREFIX_3 " == Setting default context to %s\n", 02036 gContext); 02037 } 02038 else if (!strcasecmp(v->name, "rtptimeout")) { 02039 gRTPTimeout = atoi(v->value); 02040 if(gRTPTimeout <= 0) 02041 gRTPTimeout = 60; 02042 } 02043 else if (!strcasecmp(v->name, "tos")) { 02044 if (sscanf(v->value, "%i", &format) == 1) 02045 gTOS = format & 0xff; 02046 else if (!strcasecmp(v->value, "lowdelay")) 02047 gTOS = IPTOS_LOWDELAY; 02048 else if (!strcasecmp(v->value, "throughput")) 02049 gTOS = IPTOS_THROUGHPUT; 02050 else if (!strcasecmp(v->value, "reliability")) 02051 gTOS = IPTOS_RELIABILITY; 02052 else if (!strcasecmp(v->value, "mincost")) 02053 gTOS = IPTOS_MINCOST; 02054 else if (!strcasecmp(v->value, "none")) 02055 gTOS = 0; 02056 else 02057 ast_log(LOG_WARNING, "Invalid tos value at line %d, should be " 02058 "'lowdelay', 'throughput', 'reliability', " 02059 "'mincost', or 'none'\n", v->lineno); 02060 } 02061 else if(!strcasecmp(v->name, "amaflags")) { 02062 gAMAFLAGS = ast_cdr_amaflags2int(v->value); 02063 } 02064 else if(!strcasecmp(v->name, "accountcode")) { 02065 strncpy(gAccountcode, v->value, sizeof(gAccountcode)-1); 02066 } 02067 else if (!strcasecmp(v->name, "disallow")) { 02068 ast_parse_allow_disallow(&gPrefs, &gCapability, v->value, 0); 02069 } 02070 else if (!strcasecmp(v->name, "allow")) { 02071 const char* tcodecs = v->value; 02072 if(!strcasecmp(v->value, "all")) { 02073 tcodecs = "ulaw,alaw,g729,g723,gsm"; 02074 } 02075 ast_parse_allow_disallow(&gPrefs, &gCapability, tcodecs, 1); 02076 } 02077 else if (!strcasecmp(v->name, "dtmfmode")) { 02078 if (!strcasecmp(v->value, "inband")) 02079 gDTMFMode=H323_DTMF_INBAND; 02080 else if (!strcasecmp(v->value, "rfc2833")) 02081 gDTMFMode = H323_DTMF_RFC2833; 02082 else if (!strcasecmp(v->value, "q931keypad")) 02083 gDTMFMode = H323_DTMF_Q931; 02084 else if (!strcasecmp(v->value, "h245alphanumeric")) 02085 gDTMFMode = H323_DTMF_H245ALPHANUMERIC; 02086 else if (!strcasecmp(v->value, "h245signal")) 02087 gDTMFMode = H323_DTMF_H245SIGNAL; 02088 else { 02089 ast_log(LOG_WARNING, "Unknown dtmf mode '%s', using rfc2833\n", 02090 v->value); 02091 gDTMFMode = H323_DTMF_RFC2833; 02092 } 02093 } 02094 v = v->next; 02095 } 02096 02097 cat = ast_category_browse(cfg, NULL); 02098 while(cat) 02099 { 02100 if(strcasecmp(cat, "general")) 02101 { 02102 int friend_type = 0; 02103 utype = ast_variable_retrieve(cfg, cat, "type"); 02104 if(utype) 02105 { 02106 friend_type = strcasecmp(utype, "friend"); 02107 if(!strcmp(utype, "user") || 0 == friend_type) 02108 { 02109 user = build_user(cat, ast_variable_browse(cfg, cat)); 02110 if (user) 02111 { 02112 ast_mutex_lock(&userl.lock); 02113 user->next = userl.users; 02114 userl.users = user; 02115 ast_mutex_unlock(&userl.lock); 02116 } 02117 else { 02118 ast_log(LOG_WARNING, "Failed to build user %s\n", cat); 02119 } 02120 } 02121 if(!strcasecmp(utype, "peer") || 0 == friend_type) 02122 { 02123 peer = build_peer(cat, ast_variable_browse(cfg, cat), friend_type); 02124 if(peer) 02125 { 02126 ast_mutex_lock(&peerl.lock); 02127 peer->next = peerl.peers; 02128 peerl.peers = peer; 02129 ast_mutex_unlock(&peerl.lock); 02130 } 02131 else { 02132 ast_log(LOG_WARNING, "Failed to build peer %s\n", cat); 02133 } 02134 } 02135 } 02136 } 02137 cat = ast_category_browse(cfg, cat); 02138 } 02139 ast_config_destroy(cfg); 02140 02141 02142 /* Determine ip address if neccessary */ 02143 if(!strlen(gIP)) 02144 { 02145 ooGetLocalIPAddress(gIP); 02146 if(!strcmp(gIP, "127.0.0.1")) 02147 { 02148 ast_log(LOG_NOTICE, "Failed to determine local ip address. Please " 02149 "specify it in ooh323.conf. OOH323 Disabled\n"); 02150 return 1; 02151 } 02152 } 02153 02154 if(gH323Debug) 02155 ast_verbose("+++ reload_config\n"); 02156 02157 return 0; 02158 02159 }
| int restart_monitor | ( | void | ) |
Start the channel monitor thread.
Definition at line 2734 of file chan_ooh323.c.
02735 { 02736 pthread_attr_t attr; 02737 02738 /* If we're supposed to be stopped -- stay stopped */ 02739 if (monitor_thread == AST_PTHREADT_STOP) 02740 return 0; 02741 if (ast_mutex_lock(&monlock)) { 02742 ast_log(LOG_WARNING, "Unable to lock monitor\n"); 02743 return -1; 02744 } 02745 if (monitor_thread == pthread_self()) { 02746 ast_mutex_unlock(&monlock); 02747 ast_log(LOG_WARNING, "Cannot kill myself\n"); 02748 return -1; 02749 } 02750 if (monitor_thread != AST_PTHREADT_NULL) { 02751 /* Wake up the thread */ 02752 pthread_kill(monitor_thread, SIGURG); 02753 } 02754 else { 02755 pthread_attr_init(&attr); 02756 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); 02757 /* Start a new monitor */ 02758 if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) { 02759 ast_mutex_unlock(&monlock); 02760 ast_log(LOG_ERROR, "Unable to start monitor thread.\n"); 02761 return -1; 02762 } 02763 } 02764 ast_mutex_unlock(&monlock); 02765 return 0; 02766 }
| void setup_rtp_connection | ( | ooCallData * | call, | |
| const char * | remoteIp, | |||
| int | remotePort | |||
| ) |
Definition at line 3184 of file chan_ooh323.c.
References ast_log(), ast_rtp_set_peer(), ast_verbose(), find_call(), gH323Debug, LOG_ERROR, and ooh323_pvt::rtp.
03186 { 03187 struct ooh323_pvt *p = NULL; 03188 struct sockaddr_in them; 03189 03190 if(gH323Debug) 03191 ast_verbose("--- setup_rtp_connection\n"); 03192 03193 /* Find the call or allocate a private structure if call not found */ 03194 p = find_call(call); 03195 03196 if (!p) { 03197 ast_log(LOG_ERROR, "Something is wrong: rtp\n"); 03198 return; 03199 } 03200 03201 them.sin_family = AF_INET; 03202 them.sin_addr.s_addr = inet_addr(remoteIp); /* only works for IPv4 */ 03203 them.sin_port = htons(remotePort); 03204 ast_rtp_set_peer(p->rtp, &them); 03205 03206 if(gH323Debug) 03207 ast_verbose("+++ setup_rtp_connection\n"); 03208 03209 return; 03210 }
| int update_our_aliases | ( | ooCallData * | call, | |
| struct ooh323_pvt * | p | |||
| ) |
Definition at line 3239 of file chan_ooh323.c.
References ooh323_pvt::callee_dialedDigits, ooh323_pvt::callee_email, ooh323_pvt::callee_h323id, and ooh323_pvt::callee_url.
Referenced by ooh323_onReceivedSetup().
03240 { 03241 int updated = -1; 03242 ooAliases *psAlias=NULL; 03243 03244 if(!call->ourAliases) 03245 return updated; 03246 psAlias = call->ourAliases; 03247 while(psAlias) 03248 { 03249 if(psAlias->type == T_H225AliasAddress_h323_ID) 03250 { 03251 strncpy(p->callee_h323id, psAlias->value, sizeof(p->callee_h323id)-1); 03252 updated = 1; 03253 } 03254 if(psAlias->type == T_H225AliasAddress_dialedDigits) 03255 { 03256 strncpy(p->callee_dialedDigits, psAlias->value, 03257 sizeof(p->callee_dialedDigits)-1); 03258 updated = 1; 03259 } 03260 if(psAlias->type == T_H225AliasAddress_url_ID) 03261 { 03262 strncpy(p->callee_url, psAlias->value, sizeof(p->callee_url)-1); 03263 updated = 1; 03264 } 03265 if(psAlias->type == T_H225AliasAddress_email_ID) 03266 { 03267 strncpy(p->callee_email, psAlias->value, sizeof(p->callee_email)-1); 03268 updated = 1; 03269 } 03270 psAlias = psAlias->next; 03271 } 03272 return updated; 03273 }
1.5.9