/** Costructs a new Jukebox. */ public Jukebox(SipProvider sip_provider, UserAgentProfile user_profile) { log = sip_provider.getLog(); this.user_profile = user_profile; this.sip_provider = sip_provider; if (user_profile.contact_url == null) user_profile.contact_url = user_profile.username + "@" + sip_provider.getViaAddress() + ":" + sip_provider.getPort(); if (!user_profile.no_prompt) stdout = System.out; if (user_profile.do_register) { RegisterAgent ra = new RegisterAgent( sip_provider, user_profile.from_url, user_profile.contact_url, user_profile.username, user_profile.username, user_profile.realm, user_profile.passwd, this); ra.loopRegister(user_profile.expires, user_profile.expires / 2); } UserAgent ua = new UserAgent(sip_provider, user_profile, this); ua.listen(); }
/** When a new call is incoming */ public void onUaCallIncoming( UserAgent ua, SessionDescriptor remote_sdp, NameAddress callee, NameAddress caller) { printOut("Incoming Call from " + caller.toString()); String audio_file = callee.getAddress().getParameter(PARAM_RESOURCE); if (audio_file != null) if (new File(audio_file).isFile()) user_profile.send_file = audio_file; if (user_profile.send_file != null) ua.accept(); else ua.hangup(); user_profile.audio_port++; ua = new UserAgent(sip_provider, user_profile, this); ua.listen(); }