+
+ protected CallInfo? lookup_call(int gsm_id)
+ {
+ for (weak List<CallInfo> i = calls; i != null; i = i.next)
+ if (i.data.gsm_id == gsm_id)
+ return i.data;
+ return null;
+ }
+
+ public void on_call_status(int index, string status, HashTable<string, Value?> properties)
+ {
+ stderr.printf("CALL STATUS %d %s\n", index, status);
+ dump_table(properties);
+
+ CallInfo? info = lookup_call(index);
+ if (info == null)
+ {
+ Value? v = properties.lookup("peer");
+ string title;
+ if (v != null)
+ title = "%s call from %s".printf(status, v.get_string());
+ else
+ title = "%s call".printf(status);
+
+ info = new CallInfo();
+ info.gsm_id = index;
+ info.log_id = zavai.log.log.start("call", title);
+ calls.append(info);
+ }
+
+ // Log a summary of all info
+ string call_info = "status: %s\n".printf(status);
+ properties.for_each((pk, pv) => {
+ string k = (string)pk;
+ Value? v = (Value?)pv;
+ call_info = call_info + "%s: %s\n".printf(k, v == null ? "(null)" : v.strdup_contents());
+ });
+ zavai.log.log.add(info.log_id, call_info);
+
+ // TODO: remove entry when it's the last possible status
+
+ /*
+ dbg("cbCallStatus %d, %s, %s" % (id, status, formatDict(properties)))
+ self.status = status
+ if status == "incoming":
+ if "peer" in properties and properties["peer"] == "+358942832031":
+ self.gsm_call_iface.ReleaseAll()
+ os.system("kapula-debug-call-handler &")
+ else:
+ os.system("alsactl restore -f /etc/alsa-scenarios/stereoout-maxvolume.state")
+ os.system("vibrator-start")
+ os.system("ringtone-start")
+ os.system("ledctrl --on-time 400 --off-time 200 gta02-aux:red");
+ if status == "release":
+ os.system("ringtone-stop")
+ os.system("vibrator-stop")
+ os.system("ledctrl --off gta02-aux:red");
+ */
+ }