所以我有一個編譯和運行的虹吸應用程序,但它只是不會打電話。 我得到:虹吸調用不起作用 - pjsip
註冊錯誤 - 默認錯誤消息。
完整的錯誤是這樣的:
15:04:02.032 pjsua_call.c撥打電話與ACC#0到SIP:[email protected] 15:04:02.032 pjsua_call.c .Unable進行呼叫,因爲賬號是無效的:無效操作(PJ_EINVALIDOP)狀態= 70013] 15:04:05.580 call.m錯誤撥打電話:無效操作(PJ_EINVALIDOP)狀態= 70013]
但是當我使用同一個帳戶在不同的SIP應用程序,它工作得很好。
當pjsip調用sip_dial_with_uri(_sip_acc_id,[url UTF8String],& call_id);
_sip_acc_id爲0,因爲我認爲這是在虹吸設置中的第0個帳戶。 網址是正確的電話號碼我正在嘗試撥打,但顯示如下: SIP:[email protected] 和呼叫ID只是一個參考,所以我不知道它是否重要。
當我看着其他voip應用程序,他們有一個註冊過程。你在哪裏輸入用戶名,密碼和SIP服務器域或IP。
對於虹吸管,這是在設置文件中完成的。但是,如果「註冊或登錄」是在Siphon的代碼中完成的,我不確定。 這可能是問題嗎?
這是試圖使實際調用的代碼:
/** FIXME plutôt à mettre dans l'objet qui gère les appels **/
-(void) dialup:(NSString *)phoneNumber number:(BOOL)isNumber
{
pjsua_call_id call_id;
pj_status_t status;
NSString *number;
UInt32 hasMicro, size;
// Verify if microphone is available (perhaps we should verify in another place ?)
size = sizeof(hasMicro);
AudioSessionGetProperty(kAudioSessionProperty_AudioInputAvailable,
&size, &hasMicro);
/*if (!hasMicro)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"No Microphone Available", @"SiphonApp")
message:NSLocalizedString(@"Connect a microphone to phone", @"SiphonApp")
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"SiphonApp")
otherButtonTitles:nil];
[alert show];
[alert release];
return;
}*/
if (isNumber)
number = [self normalizePhoneNumber:phoneNumber];
else
number = phoneNumber;
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"removeIntlPrefix"])
{
number = [number stringByReplacingOccurrencesOfString:@"+"
withString:@""
options:0
range:NSMakeRange(0,1)];
}
else
{
NSString *prefix = [[NSUserDefaults standardUserDefaults] stringForKey:
@"intlPrefix"];
if ([prefix length] > 0)
{
number = [number stringByReplacingOccurrencesOfString:@"+"
withString:prefix
options:0
range:NSMakeRange(0,1)];
}
}
// Manage pause symbol
NSArray * array = [number componentsSeparatedByString:@","];
[callViewController setDtmfCmd:@""];
if ([array count] > 1)
{
number = [array objectAtIndex:0];
[callViewController setDtmfCmd:[array objectAtIndex:1]];
}
if (!isConnected && [self wakeUpNetwork] == NO)
{
_phoneNumber = [[NSString stringWithString: number] retain];
if (isIpod)
{
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:nil
message:NSLocalizedString(@"You must enable Wi-Fi or SIP account to place a call.",@"SiphonApp")
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK",@"SiphonApp")
otherButtonTitles:nil] autorelease];
[alertView show];
}
else
{
UIActionSheet *actionSheet = [[[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"The SIP server is unreachable!",@"SiphonApp")
delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel",@"SiphonApp")
destructiveButtonTitle:nil
otherButtonTitles:NSLocalizedString(@"Cellular call",@"SiphonApp"),
nil] autorelease];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView: self.window];
}
return;
}
if ([self sipConnect])
{
NSRange range = [number rangeOfString:@"@"];
NSLog(@"%i", _sip_acc_id);
if (range.location != NSNotFound)
{
status = sip_dial_with_uri(_sip_acc_id, [[NSString stringWithFormat:@"sip:%@", number] UTF8String], &call_id);
}
else
status = sip_dial(_sip_acc_id, [number UTF8String], &call_id);
if (status != PJ_SUCCESS)
{
// FIXME
//[self displayStatus:status withTitle:nil];
const pj_str_t *str = pjsip_get_status_text(status);
NSString *msg = [[NSString alloc]
initWithBytes:str->ptr
length:str->slen
encoding:[NSString defaultCStringEncoding]];
[self displayError:msg withTitle:@"registration error"];
}
}
}
此外,如果任何人有一個鏈接到虹吸式應用程序的代碼,這是新的,也許效果更好,我會很感激這一點。
更多信息:
在call.m文件基本上是這樣被調用:
status = pjsua_call_make_call(acc_id, &pj_uri, 0, NULL, NULL, call_id);
這裏
ACC_ID = 0
pj_uri =字符* - >「SIP: [email protected]「 pj_ssize_t - > 33
CALL_ID = 803203976
使用[此示例鏈接](https://github.com/radif/SIPHON-SIP-Client-that-actually-compiles)。它是我找到的最新的更新,並且很好地接聽電話。希望有幫助 –