diff --git a/Classes/VoiceBase/SIP/MGMSIP.h b/Classes/VoiceBase/SIP/MGMSIP.h index dae2163..3b7f026 100644 --- a/Classes/VoiceBase/SIP/MGMSIP.h +++ b/Classes/VoiceBase/SIP/MGMSIP.h @@ -125,7 +125,7 @@ typedef enum { - (void)stop; - (void)restart; -- (void)registerThread; +- (void)registerThread:(pj_thread_desc *)thePJThreadDesc; - (void)loginToAccount:(MGMSIPAccount *)theAccount; - (void)logoutOfAccount:(MGMSIPAccount *)theAccount; diff --git a/Classes/VoiceBase/SIP/MGMSIP.m b/Classes/VoiceBase/SIP/MGMSIP.m index e9dc307..9ce16b8 100644 --- a/Classes/VoiceBase/SIP/MGMSIP.m +++ b/Classes/VoiceBase/SIP/MGMSIP.m @@ -359,7 +359,8 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void [pool drain]; return; } - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; PJPool = pjsua_pool_create("MGMSIP-pjsua", 1000, 1000); @@ -427,6 +428,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void status = pjsua_init(&sipConfig, &loggingConfig, &mediaConfig); if (status!=PJ_SUCCESS) { NSLog(@"Error initializing PJSUA"); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [self stop]; [lock unlock]; [pool drain]; @@ -438,6 +440,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void status = pjmedia_tonegen_create2(PJPool, &name, mediaConfig.clock_rate, mediaConfig.channel_count, samplesPerFrame, 16, PJMEDIA_TONEGEN_LOOP, &ringbackPort); if (status!=PJ_SUCCESS) { NSLog(@"Error creating ringback tones"); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [self stop]; [lock unlock]; [pool drain]; @@ -456,6 +459,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void status = pjsua_conf_add_port(PJPool, ringbackPort, &ringbackSlot); if (status!=PJ_SUCCESS) { NSLog(@"Error adding ringback tone"); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [self stop]; [lock unlock]; [pool drain]; @@ -470,6 +474,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &transportConfig, &UDPTransport); if (status!=PJ_SUCCESS) { NSLog(@"Error creating transport"); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [self stop]; [lock unlock]; [pool drain]; @@ -492,6 +497,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void status = pjsua_start(); if (status!=PJ_SUCCESS) { NSLog(@"Error starting PJSUA"); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [self stop]; [lock unlock]; [pool drain]; @@ -513,6 +519,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void NSLog(@"MGMSIP Started"); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [lock unlock]; [pool drain]; } @@ -532,7 +539,8 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void [accounts makeObjectsPerformSelector:@selector(logout)]; - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; if (ringbackPort!=NULL && ringbackSlot!=PJSUA_INVALID_ID) { pjsua_conf_remove_port(ringbackSlot); @@ -551,6 +559,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void status = pjsua_destroy(); if (status!=PJ_SUCCESS) NSLog(@"Error stopping SIP"); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); state = MGMSIPStoppedState; @@ -596,11 +605,10 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void [self stop]; } -- (void)registerThread { - pj_thread_desc PJThreadDesc; +- (void)registerThread:(pj_thread_desc *)thePJThreadDesc { if (!pj_thread_is_registered()) { pj_thread_t *PJThread; - pj_status_t status = pj_thread_register(NULL, PJThreadDesc, &PJThread); + pj_status_t status = pj_thread_register(NULL, *thePJThreadDesc, &PJThread); if (status!=PJ_SUCCESS) NSLog(@"Error registering thread for PJSUA with status %d", status); } @@ -625,7 +633,8 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void return; } - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; pjsua_acc_config accountConfig; pjsua_acc_config_default(&accountConfig); @@ -666,11 +675,13 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void [theAccount loginErrored]; NSLog(@"Error With Account %@: %@", theAccount, [theAccount lastError]); [accounts removeObject:theAccount]; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [pool drain]; return; } [theAccount setIdentifier:identifier]; [theAccount setOnline:YES]; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); if (delegate!=nil && [delegate respondsToSelector:@selector(accountLoggedIn:)]) [delegate accountLoggedIn:theAccount]; if ([theAccount delegate]!=nil && [[theAccount delegate] respondsToSelector:@selector(loggedIn)]) [[theAccount delegate] loggedIn]; [pool drain]; @@ -686,7 +697,8 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void return; } - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; pj_status_t status = pjsua_acc_del([theAccount identifier]); if (status!=PJ_SUCCESS) { @@ -700,6 +712,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void if (delegate!=nil && [delegate respondsToSelector:@selector(accountLoggedOut:)]) [delegate accountLoggedOut:theAccount]; if ([theAccount delegate]!=nil && [[theAccount delegate] respondsToSelector:@selector(loggedOut)]) [[theAccount delegate] loggedOut]; [accounts removeObject:theAccount]; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [pool drain]; } @@ -722,30 +735,36 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void } - (void)hangUpAllCalls { - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; pjsua_call_hangup_all(); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (float)volume { return [[NSUserDefaults standardUserDefaults] floatForKey:MGMSIPVolume]; } - (void)setVolume:(float)theVolume { - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; [[NSUserDefaults standardUserDefaults] setFloat:theVolume forKey:MGMSIPVolume]; pjsua_conf_adjust_tx_level(0, theVolume); [[NSNotificationCenter defaultCenter] postNotificationName:MGMSIPVolumeChangedNotification object:[NSNumber numberWithFloat:theVolume]]; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (float)micVolume { return [[NSUserDefaults standardUserDefaults] floatForKey:MGMSIPMicVolume]; } - (void)setMicVolume:(float)theVolume { - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; [[NSUserDefaults standardUserDefaults] setFloat:theVolume forKey:MGMSIPMicVolume]; pjsua_conf_adjust_rx_level(0, theVolume); [[NSNotificationCenter defaultCenter] postNotificationName:MGMSIPMicVolumeChangedNotification object:[NSNumber numberWithFloat:theVolume]]; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (BOOL)setInputSoundDevice:(int)theInputDevice outputSoundDevice:(int)theOutputDevice { @@ -790,18 +809,22 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void [defaults setObject:inputDeviceUID forKey:MGMSIPACurrentInputDevice]; [defaults setObject:outputDeviceUID forKey:MGMSIPACurrentOutputDevice]; - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; pj_status_t status = pjsua_set_snd_dev(theInputDevice, theOutputDevice); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); return (status==PJ_SUCCESS); } - (BOOL)stopSound { if (state!=MGMSIPStartedState) return NO; - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; pj_status_t status = pjsua_set_null_snd_dev(); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); return (status==PJ_SUCCESS); } - (void)updateAudioDevices { @@ -919,7 +942,8 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void if (audioDevices!=nil) [audioDevices release]; audioDevices = [devicesArray copy]; - [self registerThread]; + pj_thread_desc PJThreadDesc; + [self registerThread:&PJThreadDesc]; pjsua_set_null_snd_dev(); pjmedia_snd_deinit(); @@ -928,6 +952,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void [self setInputSoundDevice:currentInput outputSoundDevice:currentOutput]; [[NSNotificationCenter defaultCenter] postNotificationName:MGMSIPAudioChangedNotification object:audioDevices]; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); [pool drain]; } - (NSArray *)audioDevices { diff --git a/Classes/VoiceBase/SIP/MGMSIPAccount.m b/Classes/VoiceBase/SIP/MGMSIPAccount.m index 9c121fd..6604ed3 100644 --- a/Classes/VoiceBase/SIP/MGMSIPAccount.m +++ b/Classes/VoiceBase/SIP/MGMSIPAccount.m @@ -247,10 +247,12 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; if (identifier==PJSUA_INVALID_ID) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_acc_set_registration(identifier, (isRegistered ? PJ_TRUE : PJ_FALSE)); [self setOnline:isRegistered]; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)networkConnected:(NSNotification *)theNotification { if ([self isLoggedIn]) @@ -260,10 +262,12 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; if (identifier==PJSUA_INVALID_ID) return 0; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_acc_info accountInfo; pj_status_t status = pjsua_acc_get_info(identifier, &accountInfo); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); if (status!=PJ_SUCCESS) return 0; return accountInfo.status; @@ -272,10 +276,12 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; if (identifier==PJSUA_INVALID_ID) return nil; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_acc_info accountInfo; pj_status_t status = pjsua_acc_get_info(identifier, &accountInfo); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); if (status!=PJ_SUCCESS) return nil; return [NSString stringWithPJString:accountInfo.status_text]; @@ -284,10 +290,12 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; if (identifier==PJSUA_INVALID_ID) return -1; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_acc_info accountInfo; pj_status_t status = pjsua_acc_get_info(identifier, &accountInfo); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); if (status!=PJ_SUCCESS) return -1; return accountInfo.expires; @@ -297,10 +305,12 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; if (identifier==PJSUA_INVALID_ID) return NO; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_acc_info accountInfo; pj_status_t status = pjsua_acc_get_info(identifier, &accountInfo); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); if (status!=PJ_SUCCESS) return NO; return (accountInfo.online_status==PJ_TRUE); @@ -309,7 +319,8 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; if ([self identifier]==PJSUA_INVALID_ID) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_status_t status = pjsua_acc_set_online_status(identifier, (isOnline ? PJ_TRUE : PJ_FALSE)); if (status==PJ_SUCCESS) { @@ -321,15 +332,18 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; if (isOnline) reregisterTimer = [[NSTimer scheduledTimerWithTimeInterval:(float)reregisterTimeout target:self selector:@selector(reregister) userInfo:nil repeats:YES] retain]; } + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (NSString *)onlineStatusText { if (identifier==PJSUA_INVALID_ID) return nil; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_acc_info accountInfo; pj_status_t status = pjsua_acc_get_info(identifier, &accountInfo); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); if (status!=PJ_SUCCESS) return nil; return [NSString stringWithPJString:accountInfo.online_status_text]; @@ -345,7 +359,8 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; return [self makeCallToSIPURL:SIPURL]; } - (MGMSIPCall *)makeCallToSIPURL:(MGMSIPURL *)theURL { - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_call_id callIdentifier; pj_str_t url = [[theURL SIPID] PJString]; @@ -356,6 +371,7 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300; } else { call = [self callWithIdentifier:callIdentifier]; } + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); return call; } - (NSArray *)calls { diff --git a/Classes/VoiceBase/SIP/MGMSIPCall.m b/Classes/VoiceBase/SIP/MGMSIPCall.m index 6da39d2..aafd632 100644 --- a/Classes/VoiceBase/SIP/MGMSIPCall.m +++ b/Classes/VoiceBase/SIP/MGMSIPCall.m @@ -19,7 +19,8 @@ account = theAccount; identifier = theIdentifier; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_call_info callInfo; pj_status_t status = pjsua_call_get_info(identifier, &callInfo); @@ -40,6 +41,7 @@ incoming = (state==MGMSIPCallIncomingState); muted = NO; } + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } return self; } @@ -142,26 +144,34 @@ if (identifier==PJSUA_INVALID_ID) return NO; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; - return pjsua_call_is_active(identifier); + pj_bool_t active = pjsua_call_is_active(identifier); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); + return (active==PJ_TRUE); } - (BOOL)hasMedia { if (identifier==PJSUA_INVALID_ID) return NO; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; - return pjsua_call_has_media(identifier); + pj_bool_t media = pjsua_call_has_media(identifier); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); + return (media==PJ_TRUE); } - (BOOL)hasActiveMedia { if (identifier==PJSUA_INVALID_ID) return NO; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_call_info callInfo; pjsua_call_get_info(identifier, &callInfo); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); return (callInfo.media_status==PJSUA_CALL_MEDIA_ACTIVE); } @@ -175,10 +185,12 @@ if (identifier==PJSUA_INVALID_ID) return NO; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_call_info callInfo; pjsua_call_get_info(identifier, &callInfo); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); return (callInfo.media_status==PJSUA_CALL_MEDIA_REMOTE_HOLD); } - (void)setHoldMusicPath:(NSString *)thePath { @@ -186,7 +198,8 @@ holdMusicPath = [thePath copy]; } - (void)hold { - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; if (state==MGMSIPCallConfirmedState) { pjsua_conf_port_id conf_port = pjsua_call_get_conf_port(identifier); @@ -202,6 +215,7 @@ [self performSelectorOnMainThread:@selector(stopHoldMusic) withObject:nil waitUntilDone:NO]; } } + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)startHoldMusic { if (holdMusicPlayer!=PJSUA_INVALID_ID) @@ -217,17 +231,20 @@ if (identifier==PJSUA_INVALID_ID || state==MGMSIPCallDisconnectedState) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_status_t status = pjsua_call_answer(identifier, PJSIP_SC_OK, NULL, NULL); if (status!=PJ_SUCCESS) NSLog(@"Error answering call %@", self); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)hangUp { if (identifier==PJSUA_INVALID_ID || state==MGMSIPCallDisconnectedState) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_status_t status = pjsua_call_hangup(identifier, 0, NULL, NULL); if (status!=PJ_SUCCESS) @@ -238,22 +255,26 @@ if (identifier==PJSUA_INVALID_ID || state==MGMSIPCallDisconnectedState) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_status_t status = pjsua_call_answer(identifier, PJSIP_SC_RINGING, NULL, NULL); if (status!=PJ_SUCCESS) NSLog(@"Error sending ringing notification to call %@", self); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)replyWithTemporarilyUnavailable { if (identifier==PJSUA_INVALID_ID || state==MGMSIPCallDisconnectedState) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_status_t status = pjsua_call_answer(identifier, PJSIP_SC_TEMPORARILY_UNAVAILABLE, NULL, NULL); if (status!=PJ_SUCCESS) NSLog(@"Error replying 480 Temporarily Unavailable"); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)startRingback { @@ -264,11 +285,13 @@ return; isRingbackOn = YES; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; [[MGMSIP sharedSIP] setRingbackCount:[[MGMSIP sharedSIP] ringbackCount]+1]; if ([[MGMSIP sharedSIP] ringbackCount]==1 && [[MGMSIP sharedSIP] ringbackSlot]!=PJSUA_INVALID_ID) pjsua_conf_connect([[MGMSIP sharedSIP] ringbackSlot], 0); + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)stopRingback { if (identifier==PJSUA_INVALID_ID || state==MGMSIPCallDisconnectedState) @@ -278,7 +301,8 @@ return; isRingbackOn = NO; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; int ringbackCount = [[MGMSIP sharedSIP] ringbackCount]; if (ringbackCount<0) return; @@ -287,13 +311,15 @@ pjsua_conf_disconnect([[MGMSIP sharedSIP] ringbackSlot], 0); pjmedia_tonegen_rewind([[MGMSIP sharedSIP] ringbackPort]); } + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)sendDTMFDigits:(NSString *)theDigits { if (identifier==PJSUA_INVALID_ID || state!=MGMSIPCallConfirmedState) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_str_t digits = [theDigits PJString]; pj_status_t status = pjsua_call_dial_dtmf(identifier, &digits); @@ -310,6 +336,7 @@ NSLog(@"Unable to send DTMF with status %d.", status); } } + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)playSound:(NSString *)theFile { @@ -325,7 +352,8 @@ if (identifier==PJSUA_INVALID_ID || state!=MGMSIPCallConfirmedState) return PJSUA_INVALID_ID; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_player_id player_id = PJSUA_INVALID_ID; if (theFile==nil || ![[NSFileManager defaultManager] fileExistsAtPath:theFile]) @@ -340,16 +368,19 @@ if (status!=PJ_SUCCESS) NSLog(@"Unable to play sound"); } + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); return player_id; } - (void)stopPlayingSound:(pjsua_player_id *)thePlayerID { if (*thePlayerID==PJSUA_INVALID_ID) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_player_destroy(*thePlayerID); *thePlayerID = PJSUA_INVALID_ID; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (BOOL)isRecording { @@ -362,7 +393,8 @@ if (recorderID!=PJSUA_INVALID_ID || identifier==PJSUA_INVALID_ID || state!=MGMSIPCallConfirmedState) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_str_t file = [toFile PJString]; pj_status_t status = pjsua_recorder_create(&file, 0, NULL, 0, 0, &recorderID); @@ -372,6 +404,7 @@ pjsua_conf_connect(pjsua_call_get_conf_port(identifier), pjsua_recorder_get_conf_port(recorderID)); pjsua_conf_connect(0, pjsua_recorder_get_conf_port(recorderID)); } + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (void)stopRecording { [self performSelectorOnMainThread:@selector(stopRecordingMain) withObject:nil waitUntilDone:YES]; @@ -380,10 +413,12 @@ if (recorderID==PJSUA_INVALID_ID) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pjsua_recorder_destroy(recorderID); recorderID = PJSUA_INVALID_ID; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (BOOL)isMuted { @@ -393,7 +428,8 @@ if (identifier==PJSUA_INVALID_ID || holdMusicPlayer!=PJSUA_INVALID_ID || state!=MGMSIPCallConfirmedState) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_status_t status; if (muted) @@ -404,6 +440,7 @@ NSLog(@"Error %@ speakers for call %@", (muted ? @"unmuting" : @"mutting"), self); else muted = !muted; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } - (BOOL)isMicMuted { return micMuted; @@ -412,7 +449,8 @@ if (identifier==PJSUA_INVALID_ID || holdMusicPlayer!=PJSUA_INVALID_ID || state!=MGMSIPCallConfirmedState) return; - [[MGMSIP sharedSIP] registerThread]; + pj_thread_desc PJThreadDesc; + [[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; pj_status_t status; if (micMuted) @@ -423,6 +461,7 @@ NSLog(@"Error %@ microphone for call %@", (micMuted ? @"unmuting" : @"mutting"), self); else micMuted = !micMuted; + bzero(&PJThreadDesc, sizeof(pj_thread_desc)); } @end #endif \ No newline at end of file diff --git a/Classes/VoiceMac/Preferences/MGMSIPPane.m b/Classes/VoiceMac/Preferences/MGMSIPPane.m index fe39c50..b7e8aa0 100644 --- a/Classes/VoiceMac/Preferences/MGMSIPPane.m +++ b/Classes/VoiceMac/Preferences/MGMSIPPane.m @@ -74,7 +74,7 @@ [NSTask launchedTaskWithLaunchPath:relaunchPath arguments:[NSArray arrayWithObjects:pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], nil]]; [[NSApplication sharedApplication] terminate:self]; } - //[[MGMSIP sharedSIP] restart]; + [[MGMSIP sharedSIP] restart]; } if (mainView!=nil) [mainView release]; diff --git a/VoiceBase.xcodeproj/project.pbxproj b/VoiceBase.xcodeproj/project.pbxproj index 85cad3d..c6451af 100644 --- a/VoiceBase.xcodeproj/project.pbxproj +++ b/VoiceBase.xcodeproj/project.pbxproj @@ -368,7 +368,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Classes/VoiceBase/VoiceBase_Prefix.pch; INFOPLIST_FILE = Resources/VoiceBase/Info.plist; - INSTALL_PATH = "$(HOME)/Library/Frameworks"; + INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = VoiceBase; WRAPPER_EXTENSION = framework; }; @@ -390,7 +390,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Classes/VoiceBase/VoiceBase_Prefix.pch; INFOPLIST_FILE = Resources/VoiceBase/Info.plist; - INSTALL_PATH = "$(HOME)/Library/Frameworks"; + INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = VoiceBase; WRAPPER_EXTENSION = framework; }; @@ -480,7 +480,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Classes/VoiceBase/VoiceBase_Prefix.pch; INFOPLIST_FILE = Resources/VoiceBase/Info.plist; - INSTALL_PATH = "$(HOME)/Library/Frameworks"; + INSTALL_PATH = "@executable_path/../Frameworks"; OTHER_LDFLAGS = ( "-lpjsua-universal", "-lpjsip-ua-universal",